MediaProcessors
Classes | Macros | Typedefs | Functions | Variables
utests_encdec1.cpp File Reference

Encoding-decoding loop-back unit testing (test suite #1). Simple video/audio encoding-decoding with PROCS API example. More...

#include <UnitTest++/UnitTest++.h>
#include <string>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <math.h>
#include <mongoose.h>
#include <libcjson/cJSON.h>
#include <libavcodec/avcodec.h>
#include <libavutil/opt.h>
#include <libavutil/imgutils.h>
#include <libmediaprocsutils/log.h>
#include <libmediaprocsutils/check_utils.h>
#include <libmediaprocsutils/stat_codes.h>
#include <libmediaprocsutils/fifo.h>
#include <libmediaprocs/proc_if.h>
#include <libmediaprocs/procs.h>
#include <libmediaprocs/procs_api_http.h>
#include <libmediaprocs/proc.h>
#include "../src/ffmpeg_x264.h"
#include "../src/ffmpeg_m2v.h"
#include "../src/ffmpeg_mp3.h"
#include "../src/ffmpeg_lhe.h"
Include dependency graph for utests_encdec1.cpp:

Go to the source code of this file.

Classes

struct  thr_ctx_s
 
struct  ev_user_data_s
 

Macros

#define SQR(x)   ((x)*(x))
 
#define LISTENING_PORT   "8088"
 
#define LISTENING_HOST   "127.0.0.1"
 
#define TEST_DURATION_SEC   8
 
#define MIN_PSNR_VAL   40
 
#define OUTPUT_FILE_VIDEO   "/tmp/out.yuv"
 
#define OUTPUT_FILE_AUDIO   "/tmp/out.wav"
 
#define MEDIA_TYPE_VIDEO   0
 
#define MEDIA_TYPE_AUDIO   1
 
#define VIDEO_WIDTH   "352"
 
#define VIDEO_HEIGHT   "288"
 
#define SETTINGS_SAMPLE_RATE   "44100"
 
#define SETTINGS_AUDIO_BITRATE   "128000"
 
#define RESPONSE_BUF_SIZE   512*1024
 

Typedefs

typedef struct thr_ctx_s thr_ctx_t
 
typedef struct ev_user_data_s ev_user_data_t
 

Functions

static void http_client_event_handler (struct mg_connection *nc, int ev, void *ev_data)
 
static char * http_client_request (const char *method, const char *url, const char *qstring, const char *content)
 
static void http_event_handler (struct mg_connection *c, int ev, void *p)
 
static void * http_server_thr (void *t)
 
static void * enc_dec_thr (void *t)
 
static void check_psnr (int width, int height, uint8_t *frame_original, uint8_t *frame_processed, int min_psnr_val)
 
static void treat_output_frame_video (proc_frame_ctx_t *proc_frame_ctx, FILE **ref_file, int min_psnr_val)
 
static void treat_output_frame_audio (proc_frame_ctx_t *proc_frame_ctx, FILE **ref_file, int min_psnr_val)
 
static void * consumer_thr (void *t)
 
static void prepare_and_send_raw_video_data (procs_ctx_t *procs_ctx, int enc_proc_id, volatile int *ref_flag_exit)
 
static void prepare_and_send_raw_audio_data (procs_ctx_t *procs_ctx, int enc_proc_id, volatile int *ref_flag_exit)
 
static void * producer_thr (void *t)
 
static void encdec_loopback (const proc_if_t *proc_if_enc, const proc_if_t *proc_if_dec, int media_type, int min_psnr_val)
 
 SUITE (UTESTS_ENCODE_DECODE_1)
 

Variables

static const char * test_settings_patterns [][2][2]
 

Detailed Description

Encoding-decoding loop-back unit testing (test suite #1). Simple video/audio encoding-decoding with PROCS API example.

Author
Rafael Antoniello

Definition in file utests_encdec1.cpp.

Function Documentation

static void* enc_dec_thr ( void *  t)
static

Encoding-decoding loop thread.

Definition at line 390 of file utests_encdec1.cpp.

static void* http_server_thr ( void *  t)
static

Runs HTTP server thread, listening to the given port.

Definition at line 343 of file utests_encdec1.cpp.