Эх сурвалжийг харах

Z991239-1215 #comment other: mod_mediacontroller实体cmake迁移

陈礼鹏80274480 4 жил өмнө
parent
commit
68086bf919
100 өөрчлөгдсөн 942 нэмэгдсэн , 3735 устгасан
  1. 1 1
      Module/mod_interactivelog/mod_interactivelog.cpp
  2. 97 0
      Module/mod_mediacontroller/CMakeLists.txt
  3. 2 0
      Module/mod_mediacontroller/ChangeLog
  4. 0 757
      Module/mod_mediacontroller/audio.cpp
  5. 0 39
      Module/mod_mediacontroller/audio.h
  6. 0 816
      Module/mod_mediacontroller/audio_session.cpp
  7. 0 66
      Module/mod_mediacontroller/audio_session.h
  8. 4 3
      Module/mod_mediacontroller/capture.cpp
  9. 4 4
      Module/mod_mediacontroller/capture.h
  10. 0 58
      Module/mod_mediacontroller/misc.c
  11. 12 13
      Module/mod_mediacontroller/mod_mediacontroller.cpp
  12. 0 130
      Module/mod_mediacontroller/mod_mediacontroller.vcxproj
  13. 0 59
      Module/mod_mediacontroller/mod_mediacontroller.vcxproj.filters
  14. 8 0
      Module/mod_mediacontroller/stdafx.cpp
  15. 0 671
      Module/mod_mediacontroller/video_session.cpp
  16. 0 55
      Module/mod_mediacontroller/video_session.h
  17. 100 0
      Other/include/rvc_media_common.h
  18. 212 0
      Other/libaudioframework/CMakeLists.txt
  19. 4 4
      Other/libaudioframework/audiocodec.c
  20. 7 7
      Other/libaudioframework/audiocommon.c
  21. 1 1
      Other/libaudioframework/audiomicspk.c
  22. 2 2
      Other/libaudioframework/audiomicspk2.c
  23. 1 1
      Other/libaudioframework/audiomicspk3.c
  24. 1 1
      Other/libaudioframework/audioresample.c
  25. 1 1
      Other/libaudioframework/audiortp.c
  26. 1 1
      Other/libaudioframework/audiortp.h
  27. 0 225
      Other/libaudioframework/codec/bvcodec.c
  28. 0 19
      Other/libaudioframework/codec/bvcodec.h
  29. 0 212
      Other/libaudioframework/libaudioframework.vcxproj
  30. 0 296
      Other/libaudioframework/libaudioframework.vcxproj.filters
  31. 1 0
      Other/libaudioframework/precompile.h
  32. 54 0
      Other/libaudioqueue/CMakeLists.txt
  33. 2 2
      Other/libaudioqueue/libaudioqueue.cpp
  34. 0 120
      Other/libaudioqueue/libaudioqueue.vcxproj
  35. 0 39
      Other/libaudioqueue/libaudioqueue.vcxproj.filters
  36. 8 0
      Other/libaudioqueue/stdafx.cpp
  37. 71 0
      Other/libaudiorender/CMakeLists.txt
  38. 2 2
      Other/libaudiorender/libaudiorender.h
  39. 1 1
      Other/libsharememory/CMakeLists.txt
  40. 215 0
      Other/libvideoframework/CMakeLists.txt
  41. 4 4
      Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_api.cpp
  42. 1 1
      Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_api.h
  43. 3 3
      Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_decoding_state.cpp
  44. 1 1
      Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_decoding_state.h
  45. 1 1
      Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_defines.h
  46. 2 2
      Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_frame.cpp
  47. 2 2
      Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_frame.h
  48. 2 2
      Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_framelist.cpp
  49. 2 2
      Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_framelist.h
  50. 4 4
      Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_jitterbuffer.cpp
  51. 3 3
      Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_jitterbuffer.h
  52. 2 2
      Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_log.c
  53. 1 1
      Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_log.h
  54. 2 2
      Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_packet.cpp
  55. 2 1
      Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_packet.h
  56. 3 3
      Other/libvideoframework/congestion_control/cc/razor_api.c
  57. 1 1
      Other/libvideoframework/congestion_control/cc/razor_api.h
  58. 3 3
      Other/libvideoframework/congestion_control/cc/razor_log.c
  59. 1 1
      Other/libvideoframework/congestion_control/cc/razor_log.h
  60. 2 2
      Other/libvideoframework/congestion_control/cc/receiver_congestion_controller.c
  61. 4 4
      Other/libvideoframework/congestion_control/cc/receiver_congestion_controller.h
  62. 2 2
      Other/libvideoframework/congestion_control/cc/sender_congestion_controller.c
  63. 6 6
      Other/libvideoframework/congestion_control/cc/sender_congestion_controller.h
  64. 1 1
      Other/libvideoframework/congestion_control/common/cf_crc32.c
  65. 1 1
      Other/libvideoframework/congestion_control/common/cf_hex.c
  66. 1 1
      Other/libvideoframework/congestion_control/common/cf_list.c
  67. 1 1
      Other/libvideoframework/congestion_control/common/cf_skiplist.c
  68. 1 1
      Other/libvideoframework/congestion_control/common/cf_stream.c
  69. 1 1
      Other/libvideoframework/congestion_control/common/cf_unwrapper.c
  70. 1 1
      Other/libvideoframework/congestion_control/common/platform/windows/mscc.c
  71. 2 2
      Other/libvideoframework/congestion_control/estimator/ack_bitrate_estimator.c
  72. 1 1
      Other/libvideoframework/congestion_control/estimator/ack_bitrate_estimator.h
  73. 2 2
      Other/libvideoframework/congestion_control/estimator/aimd_rate_control.c
  74. 2 2
      Other/libvideoframework/congestion_control/estimator/aimd_rate_control.h
  75. 2 2
      Other/libvideoframework/congestion_control/estimator/bitrate_controller.c
  76. 2 2
      Other/libvideoframework/congestion_control/estimator/bitrate_controller.h
  77. 2 2
      Other/libvideoframework/congestion_control/estimator/cc_feedback_adapter.c
  78. 1 1
      Other/libvideoframework/congestion_control/estimator/cc_feedback_adapter.h
  79. 2 2
      Other/libvideoframework/congestion_control/estimator/cc_loss_stat.c
  80. 2 2
      Other/libvideoframework/congestion_control/estimator/cc_loss_stat.h
  81. 2 2
      Other/libvideoframework/congestion_control/estimator/delay_base_bwe.c
  82. 6 6
      Other/libvideoframework/congestion_control/estimator/delay_base_bwe.h
  83. 1 1
      Other/libvideoframework/congestion_control/estimator/estimator_common.c
  84. 1 1
      Other/libvideoframework/congestion_control/estimator/estimator_common.h
  85. 3 3
      Other/libvideoframework/congestion_control/estimator/inter_arrival.c
  86. 3 3
      Other/libvideoframework/congestion_control/estimator/kalman_filter.c
  87. 2 2
      Other/libvideoframework/congestion_control/estimator/kalman_filter.h
  88. 3 3
      Other/libvideoframework/congestion_control/estimator/overuse_detector.c
  89. 1 1
      Other/libvideoframework/congestion_control/estimator/overuse_detector.h
  90. 1 1
      Other/libvideoframework/congestion_control/estimator/rate_stat.c
  91. 1 1
      Other/libvideoframework/congestion_control/estimator/rate_stat.h
  92. 2 2
      Other/libvideoframework/congestion_control/estimator/remote_bitrate_estimator.c
  93. 8 8
      Other/libvideoframework/congestion_control/estimator/remote_bitrate_estimator.h
  94. 1 1
      Other/libvideoframework/congestion_control/estimator/remote_estimator_proxy.c
  95. 5 5
      Other/libvideoframework/congestion_control/estimator/remote_estimator_proxy.h
  96. 2 2
      Other/libvideoframework/congestion_control/estimator/sender_bandwidth_estimator.c
  97. 2 2
      Other/libvideoframework/congestion_control/estimator/sender_bandwidth_estimator.h
  98. 1 1
      Other/libvideoframework/congestion_control/estimator/sender_history.c
  99. 4 4
      Other/libvideoframework/congestion_control/estimator/sender_history.h
  100. 2 2
      Other/libvideoframework/congestion_control/estimator/trendline.c

+ 1 - 1
Module/mod_interactivelog/mod_interactivelog.cpp

@@ -291,7 +291,7 @@ public:
 		
 		char strtimebuffer[256] = {0};
 
-#ifdef _WIN32
+#ifdef RVC_OS_WIN
 		SYSTEMTIME nowTime;                             // ϵͳʱ¼ä½á¹¹Ìå
 		GetLocalTime(&nowTime);
 		sprintf_s(strtimebuffer, "%4d%02d%02d", nowTime.wYear, nowTime.wMonth, nowTime.wDay);

+ 97 - 0
Module/mod_mediacontroller/CMakeLists.txt

@@ -0,0 +1,97 @@
+define_module("mediacontroller")
+
+if(RVC_DEBUG_MODE)
+    set(STRMBASE_LIB strmbasd)
+else()
+    set(STRMBASE_LIB strmbase)
+endif(RVC_DEBUG_MODE)
+
+set(${MODULE_PREFIX}_SRCS
+    capture.h
+    Event.h
+    ExternalCameraMsg.h
+    MediaController_client_g.h
+    MediaController_def_g.h
+    MediaController_msg_g.h
+    MediaController_server_g.h
+
+    stdafx.cpp
+    capture.cpp
+    mod_mediacontroller.cpp
+)
+
+set(MOD_VERSION_STRING "0.0.1-dev1")
+add_module_libraries(${MODULE_PREFIX} ${MODULE_NAME} ${MOD_VERSION_STRING})
+
+add_precompiled_header(${MODULE_NAME} stdafx.h SOURCE_CXX stdafx.cpp FORCEINCLUDE)
+
+if(WIN32)
+conan_cmake_run(REQUIRES portaudio/v190600.20161030@LR04.02_ThirdParty/testing
+BASIC_SETUP CMAKE_TARGETS
+BUILD missing)
+else(WIN32)
+conan_cmake_run(REQUIRES portaudio/v190600.20161030@LR04.02_ThirdParty/testing
+BASIC_SETUP CMAKE_TARGETS
+BUILD missing)
+endif(WIN32)
+
+
+if(WIN32)
+conan_cmake_run(REQUIRES ffmpeg/4.1@LR04.02_ThirdParty/testing
+BASIC_SETUP CMAKE_TARGETS
+BUILD missing)
+else(WIN32)
+conan_cmake_run(REQUIRES ffmpeg/4.1@LR04.02_ThirdParty/testing
+BASIC_SETUP CMAKE_TARGETS
+BUILD missing)
+endif(WIN32)
+
+
+if(WIN32)
+conan_cmake_run(REQUIRES IPP/1.0@LR04.02_ThirdParty/testing
+BASIC_SETUP CMAKE_TARGETS
+BUILD missing)
+else(WIN32)
+conan_cmake_run(REQUIRES IPP/1.0@LR04.02_ThirdParty/testing
+BASIC_SETUP CMAKE_TARGETS
+BUILD missing)
+endif(WIN32)
+
+
+target_include_directories(${MODULE_NAME} PRIVATE
+	${CONAN_INCLUDE_DIRS_PORTAUDIO}
+	${CONAN_INCLUDE_DIRS_FFMPEG}
+	${CONAN_INCLUDE_DIRS_IPP}
+)
+
+target_link_directories(${MODULE_NAME} PRIVATE
+#	${ThirdPartyLib}
+	${CONAN_LIB_DIRS_PORTAUDIO}
+	${CONAN_LIB_DIRS_FFMPEG}
+	${CONAN_LIB_DIRS_IPP}
+)
+
+
+# 添加实体需要依赖的其他共享库(包括系统库)
+set(${MODULE_PREFIX}_LIBS  ${MODULE_BASE_LIBS} 
+#	${SPBASE_LIB}
+	${CONAN_PKG_LIBS_IPP}
+	${CONAN_PKG_LIBS_PORTAUDIO}
+	${CONAN_PKG_LIBS_FFMPEG}
+	ws2_32
+	strmiids
+	winmm
+	Vfw32
+	ole32
+	libaudioframework
+	libvideoframework
+	libaudioqueue
+	libvideoqueue
+	libvideohorflip
+	libaudiorender
+)
+target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
+
+message(STATUS "portaudio lib name is ${CONAN_PKG_LIBS_PORTAUDIO}")
+
+deploy_module(${MODULE_PREFIX} ${MODULE_NAME})

+ 2 - 0
Module/mod_mediacontroller/ChangeLog

@@ -0,0 +1,2 @@
+
+* 2020-11-11 实体迁移

+ 0 - 757
Module/mod_mediacontroller/audio.cpp

@@ -1,757 +0,0 @@
-#include "stdafx.h"
-#include "audio.h"
-
-#include <ErrorCode.h>
-#include <memutil.h>
-#include <audioframework.h>
-#include <portaudio.h>
-
-#include "SpBase.h"
-
-#define RINGBACK_FREQ1	    440
-#define RINGBACK_FREQ2	    480
-#define RINGBACK_ON	    2000
-#define RINGBACK_OFF	    4000
-#define RINGBACK_INTERVAL   4000
-
-#define DEV_PHONE		0
-#define DEV_HANDFREE	1
-
-// dont modify the same as mod_sofia/endpoint.cpp
-enum e_media_dir 
-{
-	DIR_NONE = 0,
-	DIR_TX = 1, 
-	DIR_RX = 2,
-	DIR_BOTH = 3,
-};
-
-typedef struct context_t 
-{
-	apr_pool_t *pool;
-	audio_t *parent;
-	audiocontext_t *context;
-	audiobridge_t *bridge;
-	audiortp_t *rtpstream;
-	audiocodec_t *codecstream;
-	audiomicspk_t *micspkstream[2];
-	audiodsp_t *dspstream;
-	audioaec_t *aecstream;
-	audioresize_t *resizestream;
-	audiotone_t *tonestream;
-	rtp_session_t *rtpsess;
-	int last_dir;
-	int active_dev;
-	int dev_in[2];
-	int dev_out[2];
-}context_t;
-
-struct audio_t
-{
-	apr_pool_t *pool;
-	audioengine_t *engine;
-	context_t *ctx;
-};
-
-static int translate_id(bool in_direction, int idx);
-
-static context_t *create_context(audio_t *audio, 
-								 audioengine_t *engine, 
-								 const char *local_rtp_ip, int local_rtp_port, 
-								 const char *remote_rtp_ip, int remote_rtp_port,
-								 int local_pt, int remote_pt,
-								 int local_ptime, int remote_ptime,
-								 int dir,
-								 int local_dtmf_pt, 
-								 int remote_dtmf_pt);
-static void destroy_context(context_t * ctx);
-static int update_context(context_t * ctx, int dir);
-
-static context_t *create_context(audio_t *audio, 
-	audioengine_t *engine, 
-	const char *local_rtp_ip, int local_rtp_port, 
-	const char *remote_rtp_ip, int remote_rtp_port,
-	int local_pt, int remote_pt,
-	int local_ptime, int remote_ptime,
-	int dir,
-	int local_dtmf_pt, 
-	int remote_dtmf_pt,
-	int dev0_in, int dev0_out,
-	int dev1_in, int dev1_out,
-	int active_dev)
-{
-	apr_pool_t *pool;
-	apr_status_t status;
-	context_t *ctx;
-	int clock = 8000;
-	int pt = local_pt;
-	int opt_micspk;
-	const char *codec;
-	int rc;
-
-	assert(local_pt == remote_pt);
-
-	status = apr_pool_create(&pool, NULL);
-	if (status != APR_SUCCESS)
-		return NULL;
-	
-	ctx = (context_t*)apr_palloc(pool, sizeof(context_t));
-
-	memset(ctx, 0, sizeof(context_t));
-
-	ctx->pool = pool;
-	ctx->parent = audio;
-
-	if (dev0_in >= 0) {
-		dev0_in = translate_id(true, dev0_in);
-		dev0_out = translate_id(false, dev0_out);
-		if (dev0_in < 0 || dev0_in < 0)
-			goto on_error;
-	}
-	if (dev1_in >= 0) {
-		dev1_in = translate_id(true, dev1_in);
-		dev1_out = translate_id(false, dev1_out);
-		if (dev1_in < 0 || dev1_in < 0)
-			goto on_error;
-	}
-	ctx->active_dev = active_dev;
-	ctx->dev_in[0] = dev0_in;
-	ctx->dev_in[1] = dev1_in;
-	ctx->dev_out[0] = dev0_out;
-	ctx->dev_out[1] = dev1_out;
-	if (ctx->active_dev == 0) {
-		if (dev0_out < 0)
-			goto on_error;
-	} else {
-		if (dev1_out < 0)
-			goto on_error;
-	}
-
-	ctx->last_dir = dir;
-
-	switch (pt) {
-	case 0:
-		codec = "PCMU";
-		if (local_ptime == 0)
-			local_ptime = 20;
-		if (remote_ptime == 0)
-			remote_ptime = 20;
-		break;
-#if 0
-	case 4:
-		codec = "G723";
-		if (local_ptime == 0)
-			local_ptime = 30;
-		if (remote_ptime == 0)
-			remote_ptime = 30;
-		break;
-#endif
-	case 8: 
-		codec = "PCMA";
-		if (local_ptime == 0)
-			local_ptime = 20;
-		if (remote_ptime == 0)
-			remote_ptime = 20;
-		break;
-	case 18:
-		codec = "G729";
-		if (local_ptime == 0)
-			local_ptime = 20;
-		if (remote_ptime == 0)
-			remote_ptime = 20;
-		break;
-	default:
-		codec = NULL;
-		break;
-	}
-	if (codec == NULL)
-		goto on_error;
-	assert(local_ptime == remote_ptime);
-
-	opt_micspk = AMS_OPT_AS_STREAM;
-	if (dir & DIR_TX) {
-		opt_micspk |= AMS_OPT_PLAY;
-	}
-	if (dir &DIR_RX) {
-		opt_micspk |= AMS_OPT_RECORD;
-	}
-
-	rc = rtp_session_create(local_rtp_ip, local_rtp_port, 3, &ctx->rtpsess);
-	if (rc != 0)
-		goto on_error;
-	rtp_session_reset(ctx->rtpsess, dir, remote_rtp_ip, remote_rtp_port, remote_rtp_port+1);
-
-	status = audiobridge_create(pool, engine, &ctx->bridge);
-	if (status != APR_SUCCESS)
-		goto on_error;
-
-	status = audiomicspk_create(pool, engine, opt_micspk, clock, ctx->dev_in[ctx->active_dev], ctx->dev_out[ctx->active_dev], &ctx->micspkstream[ctx->active_dev]);
-	if (status != APR_SUCCESS) {
-		Dbg("audiomicspk_create failed, dev_in[%d]:%d, dev_out[%d]:%d", ctx->dev_in[ctx->active_dev], ctx->active_dev, ctx->dev_out[ctx->active_dev], ctx->active_dev);
-		goto on_error;
-	}
-
-	if (ctx->active_dev == DEV_PHONE) {
-		status = audiodsp_create(pool, engine, AUDIO_DSP_AGC|AUDIO_DSP_DENOISE, AUDIO_DSP_AGC|AUDIO_DSP_DENOISE, clock, &ctx->dspstream);
-		if (status != APR_SUCCESS)
-			goto on_error;
-		status = audioaec_create(pool, engine, clock, FRAME_TIME, AUDIO_AEC_OPT_READ_AS_CAPTURE, &ctx->aecstream);
-		if (status != APR_SUCCESS)
-			goto on_error;
-	}
-	status = audioresize_create(pool, engine, FRAME_TIME*2*clock/1000, local_ptime*2*clock/1000, &ctx->resizestream);
-	if (status != APR_SUCCESS)
-		goto on_error;
-	status = audiocodec_create(pool, engine, codec, clock, FRAME_TIME, AUDIO_CODEC_OPT_ENCODE_WRITE, &ctx->codecstream);
-	if (status != APR_SUCCESS)
-		goto on_error;
-	status = audiortp_create(pool, engine, ctx->rtpsess, &ctx->rtpstream);
-	if (status != APR_SUCCESS)
-		goto on_error;
-	status = audiotone_create(pool, engine, TONEGEN_LOOP, clock, FRAME_TIME, &ctx->tonestream);
-	if (status != APR_SUCCESS)
-		goto on_error;
-
-	int param;
-	param = clock;
-	audiortp_set_param(ctx->rtpstream, AUDIO_RTP_FLAG_SEND_CLOCK, &param);
-	audiortp_set_param(ctx->rtpstream, AUDIO_RTP_FLAG_RECV_CLOCK, &param);
-	param = pt;
-	audiortp_set_param(ctx->rtpstream, AUDIO_RTP_FLAG_SEND_PT, &param);
-	audiortp_set_param(ctx->rtpstream, AUDIO_RTP_FLAG_RECV_PT, &param);
-	param = local_dtmf_pt;
-	audiortp_set_param(ctx->rtpstream, AUDIO_RTP_FLAG_SEND_DTMF, &param);
-	param = remote_dtmf_pt;
-	audiortp_set_param(ctx->rtpstream, AUDIO_RTP_FLAG_RECV_DTMF, &param);
-	param = local_ptime;
-	audiortp_set_param(ctx->rtpstream, AUDIO_RTP_FLAG_SEND_PTIME, &param);
-	param = remote_ptime;
-	audiortp_set_param(ctx->rtpstream, AUDIO_RTP_FLAG_RECV_PTIME, &param);
-
-	audiortp_init(ctx->rtpstream);
-
-	if (dir == DIR_TX) {
-		if (ctx->active_dev == DEV_PHONE) {
-			audiostream_connect_pipeline(STREAM_DIR_READ, &ctx->dspstream->base, &ctx->micspkstream[ctx->active_dev]->base, NULL);
-		} else {
-			audiostream_connect_pipeline(STREAM_DIR_READ, &ctx->micspkstream[ctx->active_dev]->base, NULL);
-		}
-		//audiostream_connect_pipeline(STREAM_DIR_WRITE, &ctx->resizestream->base, &ctx->codecstream->base, &ctx->rtpstream->base, NULL);
-		audiostream_connect_pipeline(STREAM_DIR_WRITE, &ctx->codecstream->base, &ctx->rtpstream->base, NULL);
-		audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_LEFT, &ctx->dspstream->base);
-		//audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_RIGHT, &ctx->resizestream->base);
-		audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_RIGHT, &ctx->codecstream->base);
-	} else if (dir == DIR_RX) {
-		audiostream_connect_pipeline(STREAM_DIR_WRITE, &ctx->micspkstream[ctx->active_dev]->base, NULL);
-		//audiostream_connect_pipeline(STREAM_DIR_READ, &ctx->resizestream->base, &ctx->codecstream->base, &ctx->rtpstream->base, NULL);
-		audiostream_connect_pipeline(STREAM_DIR_READ, &ctx->codecstream->base, &ctx->rtpstream->base, NULL);
-		audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_LEFT, &ctx->micspkstream[ctx->active_dev]->base);
-		//audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_RIGHT, &ctx->resizestream->base);
-		audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_RIGHT, &ctx->codecstream->base);
-	} else {
-		audiostream_connect_pipeline(STREAM_DIR_BOTH, &ctx->resizestream->base, &ctx->codecstream->base, &ctx->rtpstream->base, NULL);
-		audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_RIGHT, &ctx->resizestream->base);
-		if (ctx->active_dev == DEV_PHONE) {
-			audiostream_connect_pipeline(STREAM_DIR_BOTH, &ctx->aecstream->base, &ctx->dspstream->base, &ctx->micspkstream[ctx->active_dev]->base, NULL);
-			audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_LEFT, &ctx->aecstream->base);
-		} else {
-			audiostream_connect_pipeline(STREAM_DIR_BOTH, &ctx->micspkstream[ctx->active_dev]->base, NULL);
-			audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_LEFT, &ctx->micspkstream[ctx->active_dev]->base);
-		}
-	}
-
-	status = audiocontext_create(pool, engine, &ctx->context);
-	if (status != APR_SUCCESS)
-		goto on_error;
-
-	status = audiocontext_add_driver(ctx->context, &ctx->bridge->base);
-	if (status != APR_SUCCESS) {
-		audiocontext_destroy(ctx->context);
-		ctx->context = NULL;
-		goto on_error;
-	}
-
-	audioengine_start_context(engine, ctx->context);
-
-	return ctx;
-
-on_error:
-	destroy_context(ctx);
-	return NULL;
-}
-
-static void destroy_context(context_t * ctx)
-{
-	if (ctx->context) {
-		audioengine_stop_context(ctx->parent->engine, ctx->context);
-		audiocontext_remove_driver(ctx->context, &ctx->bridge->base);
-		audiocontext_destroy(ctx->context);
-		ctx->context = NULL;
-	}
-	if (ctx->bridge) {
-		audiobridge_destroy(ctx->bridge);
-		ctx->bridge = NULL;
-	}
-	if (ctx->resizestream) {
-		audioresize_destroy(ctx->resizestream);
-		ctx->resizestream = NULL;
-	}
-	if (ctx->codecstream) {
-		audiocodec_destroy(ctx->codecstream);
-		ctx->codecstream = NULL;
-	}
-	if (ctx->rtpstream) {
-		audiortp_destroy(ctx->rtpstream);
-		ctx->rtpstream = NULL;
-	}
-	if (ctx->rtpsess) {
-		rtp_session_destroy(ctx->rtpsess);
-		ctx->rtpsess = NULL;
-	}
-	if (ctx->aecstream) {
-		audioaec_destroy(ctx->aecstream);
-		ctx->aecstream = NULL;
-	}
-	if (ctx->dspstream) {
-		audiodsp_destroy(ctx->dspstream);
-		ctx->dspstream = NULL;
-	}
-	if (ctx->micspkstream[0]) {
-		audiomicspk_destroy(ctx->micspkstream[0]);
-		ctx->micspkstream[0] = NULL;
-	}
-	if (ctx->micspkstream[1]) {
-		audiomicspk_destroy(ctx->micspkstream[1]);
-		ctx->micspkstream[1] = NULL;
-	}
-	if (ctx->tonestream) {
-		audiotone_destroy(ctx->tonestream);
-		ctx->tonestream = NULL;
-	}
-
-	apr_pool_destroy(ctx->pool);
-}
-
-static int update_context(context_t * ctx, int dir)
-{
-	int clock = 8000;
-	int opt_micspk;
-	int in_dev_id = -1;
-	int out_dev_id = -1;
-	apr_pool_t *pool = ctx->pool;
-	audioengine_t *engine = ctx->parent->engine;
-	apr_status_t status;
-
-	if (ctx->last_dir == dir)
-		return 0;
-
-	audiocontext_remove_driver(ctx->context, &ctx->bridge->base);
-
-	opt_micspk = AMS_OPT_AS_STREAM;
-	if (dir & DIR_TX) {
-		opt_micspk |= AMS_OPT_PLAY;
-	}
-	if (dir &DIR_RX) {
-		opt_micspk |= AMS_OPT_RECORD;
-	}
-
-	if (ctx->micspkstream[0]) {
-		audiomicspk_destroy(ctx->micspkstream[0]);
-		ctx->micspkstream[0] = NULL;
-	}
-	if (ctx->micspkstream[1]) {
-		audiomicspk_destroy(ctx->micspkstream[1]);
-		ctx->micspkstream[1] = NULL;
-	}
-
-	if (ctx->dev_in[0] >= 0) {
-		status = audiomicspk_create(pool, engine, opt_micspk, clock, ctx->dev_in[0], ctx->dev_out[0], &ctx->micspkstream[0]);
-		if (status != APR_SUCCESS)
-			goto on_error;
-	}
-	if (ctx->dev_in[1] >= 0) {
-		status = audiomicspk_create(pool, engine, opt_micspk, clock, ctx->dev_in[1], ctx->dev_out[1], &ctx->micspkstream[1]);
-		if (status != APR_SUCCESS)
-			goto on_error;
-	}
-
-	if (dir == DIR_TX) {
-		audiostream_connect_pipeline(STREAM_DIR_READ, &ctx->dspstream->base, &ctx->micspkstream[ctx->active_dev]->base, NULL);
-		//audiostream_connect_pipeline(STREAM_DIR_WRITE, &ctx->resizestream->base, &ctx->codecstream->base, &ctx->rtpstream->base, NULL);
-		audiostream_connect_pipeline(STREAM_DIR_WRITE, &ctx->codecstream->base, &ctx->rtpstream->base, NULL);
-		audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_LEFT, &ctx->dspstream->base);
-		//audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_RIGHT, &ctx->resizestream->base);
-		audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_RIGHT, &ctx->codecstream->base);
-	} else if (dir == DIR_RX) {
-		audiostream_connect_pipeline(STREAM_DIR_WRITE, &ctx->micspkstream[ctx->active_dev]->base, NULL);
-		//audiostream_connect_pipeline(STREAM_DIR_READ, &ctx->resizestream->base, &ctx->codecstream->base, &ctx->rtpstream->base, NULL);
-		audiostream_connect_pipeline(STREAM_DIR_READ, &ctx->codecstream->base, &ctx->rtpstream->base, NULL);
-		audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_LEFT, &ctx->micspkstream[ctx->active_dev]->base);
-		//audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_RIGHT, &ctx->resizestream->base);
-		audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_RIGHT, &ctx->codecstream->base);
-	} else {
-		audiostream_connect_pipeline(STREAM_DIR_BOTH, &ctx->aecstream->base, &ctx->dspstream->base, &ctx->micspkstream[ctx->active_dev]->base, NULL);
-		audiostream_connect_pipeline(STREAM_DIR_BOTH, &ctx->resizestream->base, &ctx->codecstream->base, &ctx->rtpstream->base, NULL);
-		audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_LEFT, &ctx->aecstream->base);
-		audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_RIGHT, &ctx->resizestream->base);
-	}
-
-	audiocontext_add_driver(ctx->context, &ctx->bridge->base);
-
-	ctx->last_dir = dir;
-
-	return 0;
-
-on_error:
-	destroy_context(ctx);
-	return Error_Resource;
-}
-
-audio_t *audio_create()
-{
-	apr_pool_t *pool;
-	audio_t *audio;
-	apr_status_t status;
-
-	status = apr_pool_create(&pool, NULL);
-	if (status != APR_SUCCESS)
-		return NULL;
-
-	audio = (audio_t*)apr_palloc(pool, sizeof(audio_t));
-
-	memset(audio, 0, sizeof(audio_t));
-	audio->pool = pool;
-
-	status = audioengine_create(pool, &audio->engine);
-	if (status != APR_SUCCESS)
-		goto on_error;
-
-	audioengine_start(audio->engine);
-
-	return audio;
-
-on_error:
-
-	apr_pool_destroy(pool);
-
-	return NULL;
-}
-
-void audio_destroy(audio_t *a)
-{
-	if (a->ctx) {
-		audio_stop(a);
-	}
-	audioengine_stop(a->engine);
-	audioengine_destroy(a->engine);
-	a->engine = NULL;
-	apr_pool_destroy(a->pool);
-}
-
-int audio_start(audio_t *a, 
-				const char *local_rtp_ip, int local_rtp_port, 
-				const char *remote_rtp_ip, int remote_rtp_port, 
-				int dir, 
-				int local_pt, int remote_pt, 
-				int local_ptime, int remote_ptime, 
-				int local_dtmf_pt, int remote_dtmf_pt,
-				int dev0_in, int dev0_out, // dev0, set to -1 for not exist
-				int dev1_in, int dev1_out, // dev1, set to -1 for not exist
-				int active_dev)
-{
-	if (a->ctx) {
-		audio_stop(a);
-	}
-	a->ctx = create_context(a, 
-		a->engine, 
-		local_rtp_ip, 
-		local_rtp_port, 
-		remote_rtp_ip, 
-		remote_rtp_port, 
-		local_pt, 
-		remote_pt, 
-		local_ptime, 
-		remote_ptime,
-		dir, 
-		local_dtmf_pt, 
-		remote_dtmf_pt,
-		dev0_in, dev0_out,
-		dev1_in, dev1_out,
-		active_dev);
-
-	return 0;
-}
-
-int audio_stop(audio_t *a)
-{
-	if (a->ctx) {
-		destroy_context(a->ctx);
-		a->ctx = NULL;
-	}
-	return 0;
-}
-
-int audio_send_dtmf(audio_t *a, int digit)
-{
-	if (!a)
-		return Error_Param;
-
-	if (a->ctx) {
-		if (a->ctx->rtpstream) {
-			char digits[] = {(char)digit};
-			apr_status_t status = audiortp_send_dtmf(a->ctx->rtpstream, digits, 1);
-			if (status == APR_SUCCESS)
-				return Error_Succeed;
-		}
-	}
-
-	return Error_Unexpect;
-}
-
-int audio_change_dev(audio_t *a, int dev)
-{
-	if (a && a->ctx && dev != a->ctx->active_dev) {
-		context_t *ctx = a->ctx;
-		int dir = ctx->last_dir;
-		int old_dev = a->ctx->active_dev;
-		int clock = 8000;
-		apr_pool_t *pool = ctx->pool;
-		int opt_micspk;
-		audioengine_t *engine = ctx->parent->engine;
-		apr_status_t status;
-		
-		a->ctx->active_dev = dev;
-
-		audiocontext_remove_driver(ctx->context, &ctx->bridge->base);
-
-		if (ctx->micspkstream[old_dev] != NULL) {
-			audiomicspk_destroy(ctx->micspkstream[old_dev]);
-			ctx->micspkstream[old_dev] = NULL;
-		}
-
-		opt_micspk = AMS_OPT_AS_STREAM;
-		if (dir & DIR_TX) {
-			opt_micspk |= AMS_OPT_PLAY;
-		}
-		if (dir &DIR_RX) {
-			opt_micspk |= AMS_OPT_RECORD;
-		}
-
-		if (ctx->active_dev == DEV_PHONE) {
-			status = audiodsp_create(pool, engine, AUDIO_DSP_AGC|AUDIO_DSP_DENOISE, AUDIO_DSP_AGC|AUDIO_DSP_DENOISE, clock, &ctx->dspstream);
-			if (status != APR_SUCCESS)
-				goto on_error;
-			status = audioaec_create(pool, engine, clock, FRAME_TIME, AUDIO_AEC_OPT_READ_AS_CAPTURE, &ctx->aecstream);
-			if (status != APR_SUCCESS)
-				goto on_error;
-		} else {
-			if (ctx->aecstream) {
-				audioaec_destroy(ctx->aecstream);
-				ctx->aecstream = NULL;
-			}
-			if (ctx->dspstream) {
-				audiodsp_destroy(ctx->dspstream);
-				ctx->dspstream = NULL;
-			}
-		}
-
-		status = audiomicspk_create(pool, engine, opt_micspk, clock, ctx->dev_in[dev], ctx->dev_out[dev], &ctx->micspkstream[dev]);
-		if (status != APR_SUCCESS)
-			goto on_error;
-
-		if (dir == DIR_TX) {
-			if (ctx->active_dev == DEV_PHONE) {
-				audiostream_connect_pipeline(STREAM_DIR_READ, &ctx->dspstream->base, &ctx->micspkstream[ctx->active_dev]->base, NULL);
-			} else {
-				audiostream_connect_pipeline(STREAM_DIR_READ, &ctx->micspkstream[ctx->active_dev]->base, NULL);
-			}
-			//audiostream_connect_pipeline(STREAM_DIR_WRITE, &ctx->resizestream->base, &ctx->codecstream->base, &ctx->rtpstream->base, NULL);
-			audiostream_connect_pipeline(STREAM_DIR_WRITE, &ctx->codecstream->base, &ctx->rtpstream->base, NULL);
-			audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_LEFT, &ctx->dspstream->base);
-			//audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_RIGHT, &ctx->resizestream->base);
-			audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_RIGHT, &ctx->codecstream->base);
-		} else if (dir == DIR_RX) {
-			audiostream_connect_pipeline(STREAM_DIR_WRITE, &ctx->micspkstream[ctx->active_dev]->base, NULL);
-			//audiostream_connect_pipeline(STREAM_DIR_READ, &ctx->resizestream->base, &ctx->codecstream->base, &ctx->rtpstream->base, NULL);
-			audiostream_connect_pipeline(STREAM_DIR_READ, &ctx->codecstream->base, &ctx->rtpstream->base, NULL);
-			audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_LEFT, &ctx->micspkstream[ctx->active_dev]->base);
-			//audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_RIGHT, &ctx->resizestream->base);
-			audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_RIGHT, &ctx->codecstream->base);
-		} else {
-			audiostream_connect_pipeline(STREAM_DIR_BOTH, &ctx->resizestream->base, &ctx->codecstream->base, &ctx->rtpstream->base, NULL);
-			audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_RIGHT, &ctx->resizestream->base);
-			if (ctx->active_dev == DEV_PHONE) {
-				audiostream_connect_pipeline(STREAM_DIR_BOTH, &ctx->aecstream->base, &ctx->dspstream->base, &ctx->micspkstream[ctx->active_dev]->base, NULL);
-				audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_LEFT, &ctx->aecstream->base);
-			} else {
-				audiostream_connect_pipeline(STREAM_DIR_BOTH, &ctx->micspkstream[ctx->active_dev]->base, NULL);
-				audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_LEFT, &ctx->micspkstream[ctx->active_dev]->base);
-			}
-		}
-		audiocontext_add_driver(ctx->context, &ctx->bridge->base);
-		return 0;
-
-on_error:
-		destroy_context(ctx);
-	}
-	return Error_Unexpect;
-}
-
-int audio_start_ringback(audio_t *a)
-{
-	if (a && a->ctx) {
-		context_t *ctx = a->ctx;
-		audiotone_play_start_tone(ctx->tonestream, RINGBACK_FREQ1, RINGBACK_FREQ2, RINGBACK_ON, RINGBACK_OFF, 0, TONEGEN_LOOP);
-		audiocontext_remove_driver(ctx->context, &ctx->bridge->base);
-		audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_RIGHT, &ctx->tonestream->base);
-		audiocontext_add_driver(ctx->context, &ctx->bridge->base);
-		return 0;
-	}
-	return Error_Unexpect;
-}
-
-int audio_stop_ringback(audio_t *a)
-{
-	if (a && a->ctx) {
-		context_t *ctx = a->ctx;
-		int dir = ctx->last_dir;
-		audiocontext_remove_driver(ctx->context, &ctx->bridge->base);
-		audiotone_play_end(ctx->tonestream);
-		if (dir == DIR_TX) {
-			audiostream_connect_pipeline(STREAM_DIR_WRITE, &ctx->codecstream->base, &ctx->rtpstream->base, NULL);
-			audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_RIGHT, &ctx->codecstream->base);
-		} else if (dir == DIR_RX) {
-			audiostream_connect_pipeline(STREAM_DIR_READ, &ctx->codecstream->base, &ctx->rtpstream->base, NULL);
-			audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_RIGHT, &ctx->codecstream->base);
-		} else {
-			audiostream_connect_pipeline(STREAM_DIR_BOTH, &ctx->resizestream->base, &ctx->codecstream->base, &ctx->rtpstream->base, NULL);
-			audiobridge_set_leg(ctx->bridge, AUDIO_BRIDGE_LEG_RIGHT, &ctx->resizestream->base);
-		}
-		audiocontext_add_driver(ctx->context, &ctx->bridge->base);
-	}
-	return Error_Unexpect;
-}
-
-int audio_get_current_active_dev(audio_t *a, int *dev)
-{
-	if (dev && a && a->ctx) {
-		*dev = a->ctx->active_dev;
-		return 0;
-	}
-	return Error_Unexpect;
-}
-
-static void __stdcall __audio_log_func(int level, const char *s)
-{
-	Dbg(s);
-}
-
-int audio_lib_init()
-{
-	audio_log_set_func(&__audio_log_func);
-
-	int rc = audioframework_init();
-	if (rc != 0) {
-		return Error_Resource;
-	} else {
-		int icnt, ocnt;
-		audio_log_set_func(NULL);
-		rc = audio_get_dev_count(&icnt, &ocnt);
-		if (rc == 0) {
-			int i;
-			Dbg("audio input devices(%d):", icnt);
-			for (i = 0; i < icnt; ++i) {
-				CSimpleStringA str = audio_get_dev_name(true, i);
-				Dbg("%d = %s", i, (LPCSTR)str);
-			}
-			Dbg("audio output devices(%d):", ocnt);
-			for (i = 0; i < ocnt; ++i) {
-				CSimpleStringA str = audio_get_dev_name(false, i);
-				Dbg("%d = %s", i, (LPCSTR)str);
-			}
-		}
-		audio_log_set_func(&__audio_log_func);
-	}
-	return 0;
-}
-
-void audio_lib_deinit()
-{
-	audioframework_term();
-}
-
-int audio_get_dev_count(int *in_cnt, int *out_cnt)
-{
-	int icnt = 0, ocnt = 0;
-	int cnt = Pa_GetDeviceCount();
-	for (int i = 0; i < cnt; ++i) {
-		const PaDeviceInfo *info = Pa_GetDeviceInfo(i);
-		if (info->maxInputChannels)
-			icnt ++;
-		if (info->maxOutputChannels)
-			ocnt ++;
-	}
-	if (in_cnt)
-		*in_cnt = icnt;
-	if (out_cnt)
-		*out_cnt = ocnt;
-	return 0;
-}
-
-CSimpleStringA audio_get_dev_name(bool in_direction, int idx)
-{
-	audio_log_set_func(NULL);
-	int cnt = Pa_GetDeviceCount();
-	int ii, i;
-	for (i = 0, ii = 0; i < cnt; ++i) {
-		const PaDeviceInfo *info = Pa_GetDeviceInfo(i);
-		if (in_direction) {
-			if (info->maxInputChannels) {
-				if (idx == ii) {
-					audio_log_set_func(__audio_log_func);
-					return CSimpleStringA(info->name);
-				}
-				ii++;
-			}
-		} else {
-			if (info->maxOutputChannels) {
-				if (idx == ii) {
-					audio_log_set_func(__audio_log_func);
-					return CSimpleStringA(info->name);
-				}
-				ii++;
-			}
-		}
-	}
-	audio_log_set_func(__audio_log_func);
-	return CSimpleStringA();
-}
-
-static int translate_id(bool in_direction, int idx)
-{
-	int i, n, ii;
-	audio_log_set_func(NULL);
-	n = Pa_GetDeviceCount();
-	for (i = 0, ii = 0; i < n; ++i) {
-		const PaDeviceInfo *info = Pa_GetDeviceInfo(i);
-		if (in_direction) {
-			if (info->maxInputChannels) {
-				if (ii == idx) {
-					audio_log_set_func(__audio_log_func);
-					return i;
-				}
-				ii++;
-			}
-		} else {
-			if (info->maxOutputChannels) {
-				if (ii == idx) {
-					audio_log_set_func(__audio_log_func);
-					return i;
-				}
-				ii++;
-			}
-		}
-	}
-	audio_log_set_func(__audio_log_func);
-	return -1;
-}

+ 0 - 39
Module/mod_mediacontroller/audio.h

@@ -1,39 +0,0 @@
-#ifndef AUDIO_H
-#define AUDIO_H
-
-#pragma once
-
-typedef struct audio_t audio_t;
-
-audio_t *audio_create();
-void audio_destroy(audio_t *a);
-int audio_start(audio_t *a, 
-	const char *local_rtp_ip, 
-	int local_rtp_port, 
-	const char *remote_rtp_ip, 
-	int remote_rtp_port, 
-	int dir, 
-	int local_pt, 
-	int remote_pt, 
-	int local_ptime, 
-	int remote_ptime, 
-	int local_dtmf_pt, 
-	int remote_dtmf_pt,
-	int dev0_in, int dev0_out, // dev0, set to -1 for not exist
-	int dev1_in, int dev1_out, // dev1, set to -1 for not exist
-	int active_dev // 0 for dev0, 1 for dev1
-	);
-int audio_stop(audio_t *a);
-int audio_send_dtmf(audio_t *a, int digit);
-int audio_change_dev(audio_t *a, int dev);
-int audio_get_current_active_dev(audio_t *a, int *dev);
-int audio_start_ringback(audio_t *a);
-int audio_stop_ringback(audio_t *a);
-
-int audio_lib_init();
-void audio_lib_deinit();
-
-int audio_get_dev_count(int *in_cnt, int *out_cnt);
-CSimpleStringA audio_get_dev_name(bool in_direction, int idx);
-
-#endif // AUDIO_H

+ 0 - 816
Module/mod_mediacontroller/audio_session.cpp

@@ -1,816 +0,0 @@
-#include "stdafx.h"
-#include "SpBase.h"
-#include "audio_session.h"
-
-#include <memutil.h>
-#include <rtp.h>
-#include <rtpsession.h>
-
-#include <audioframework.h>
-#include <portaudio.h>
-
-#include <libaudioqueue.h>
-
-#include "rec_common.h"
-
-#define AUDIO_CLOCK	8000
-#define AUDIO_SHM_FRAME_TIME	20 // 20ms
-
-typedef struct audio_recorder_t audio_recorder_t;
-typedef struct audio_phonemedia_t audio_phonemedia_t;
-
-struct audio_session_t
-{
-	audio_session_conf_t conf;
-	Clibaudioqueue *m_audio_shm_q;
-	void *object;
-	int (*stop)(void *object);
-	void (*destroy)(void *object);
-};
-
-static int translate_id(int in_direction, int idx);
-
-//....
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-//// audio recorder, get captured buffer, and write to audio share memory queue
-
-struct audio_recorder_t
-{
-	apr_pool_t *pool;
-	audiomicspk_t *micspkstream;
-	audioresize_t *resizestream;
-	audiocustom_t *customstream;
-	audio_session_t *owner;
-};
-
-static apr_status_t recorder_on_write_frame(void *cust, const audioframe_t *frm, void *user_data)
-{
-	audio_recorder_t *recorder = (audio_recorder_t *)user_data;
-	audio_session_t *session = recorder->owner;
-	audio_frame *tmp_frm = NULL;
-	try {
-		tmp_frm = new audio_frame();
-		tmp_frm->data = new char[frm->size];
-		memcpy(tmp_frm->data, frm->buffer, frm->size);
-		tmp_frm->format = 1;
-		tmp_frm->framesize = frm->size;
-		tmp_frm->nchannels = 1;
-		tmp_frm->samplespersec = AUDIO_CLOCK;
-		tmp_frm->bitspersample = 16;
-	} catch (std::bad_alloc &) {
-		Dbg("memory allocation failed!");
-		return APR_ENOMEM;
-	}
-	if (session->m_audio_shm_q->InsertAudio(tmp_frm)) { // already delete in InsertAudio
-		return APR_SUCCESS;
-	} else {
-		Dbg("shm audio queue insertaudio failed!");
-		delete tmp_frm->data;
-		delete tmp_frm;
-	}
-	return APR_EGENERAL;
-}
-
-static int recorder_create(audio_session_t *session, audio_recorder_t **p_recorder)
-{
-	audio_recorder_t *recorder = ZALLOC_T(audio_recorder_t);
-	if (recorder) {
-		recorder->owner = session;
-		return 0;
-	}
-	return -1;
-}
-
-static int recorder_start(audio_recorder_t *recorder)
-{
-	audio_session_t *session = recorder->owner;
-	apr_status_t status;
-	int dev_in;
-
-	dev_in = translate_id(TRUE, session->conf.in_dev[DEV_HANDFREE]);
-	if (dev_in < 0) {
-		Dbg("cannot find audio dev_in device, id = %d", session->conf.in_dev[DEV_HANDFREE]);
-		return Error_Param;
-	}
-
-	status = apr_pool_create(&recorder->pool, NULL);
-	if (status != APR_SUCCESS) {
-		Dbg("create pool failed!");
-		goto on_error;
-	}
-
-	status = audiomicspk_create(recorder->pool, NULL, 
-		AMS_OPT_AS_ENGINE | AMS_OPT_RECORD, AUDIO_CLOCK, 
-		dev_in, 0, &recorder->micspkstream);
-	if (status != APR_SUCCESS) {
-		Dbg("create micspk failed!");
-		goto on_error;
-	}
-
-	status = audioresize_create(recorder->pool, NULL, 
-		0, 0, FRAME_TIME*2*AUDIO_CLOCK/1000, AUDIO_SHM_FRAME_TIME*2*AUDIO_CLOCK/1000, 
-		&recorder->resizestream);
-	if (status != 0) {
-		Dbg("create audio resize failed!");
-		goto on_error;
-	}
-
-	status = audiocustom_create(recorder->pool, NULL, NULL, 
-		&recorder_on_write_frame, recorder, &recorder->customstream);
-	if (status != 0) {
-		Dbg("create audiocustom stream failed!");
-		goto on_error;
-	}
-
-	status = audiomicspk_connect_pipeline(recorder->micspkstream, STREAM_DIR_WRITE, 
-		&recorder->resizestream->base, &recorder->customstream->base, NULL);
-	if (status != 0) {
-		Dbg("audiomicspk connect pipeline failed!");
-		goto on_error;
-	}
-
-	return 0;
-
-on_error:
-	if (recorder->micspkstream) {
-		audiomicspk_disconnect_pipeline(recorder->micspkstream, NULL);
-		audiomicspk_destroy(recorder->micspkstream);
-		recorder->micspkstream = NULL;
-	}
-	if (recorder->resizestream) {
-		audioresize_destroy(recorder->resizestream);
-		recorder->resizestream = NULL;
-	}
-	if (recorder->customstream) {
-		audiocustom_destroy(recorder->customstream);
-		recorder->customstream = NULL;
-	}
-	if (recorder->pool) {
-		apr_pool_destroy(recorder->pool);
-		recorder->pool = NULL;
-	}
-
-	return Error_Resource;
-}
-
-static int recorder_stop(void *object) 
-{
-	audio_recorder_t *recorder = (audio_recorder_t*)object;
-	if (recorder->micspkstream) {
-		audiomicspk_disconnect_pipeline(recorder->micspkstream, NULL);
-		audiomicspk_destroy(recorder->micspkstream);
-		recorder->micspkstream = NULL;
-	}
-	if (recorder->resizestream) {
-		audioresize_destroy(recorder->resizestream);
-		recorder->resizestream = NULL;
-	}
-	if (recorder->customstream) {
-		audiocustom_destroy(recorder->customstream);
-		recorder->customstream = NULL;
-	}
-	if (recorder->pool) {
-		apr_pool_destroy(recorder->pool);
-		recorder->pool = NULL;
-	}
-	return 0;
-}
-
-static void recorder_destroy(void *object)
-{
-	audio_recorder_t *recorder = (audio_recorder_t*)object;
-	free(recorder);
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-//// audio phone media
-
-struct audio_phonemedia_t
-{
-	audio_session_phonemedia_conf_t conf;
-	audio_session_t *owner;
-
-	apr_pool_t *pool;
-	audioengine_t *engine;
-	audiocontext_t *context;
-
-	audiobridge_t *bridge;
-	apr_pool_t *micspk_pool;
-	audiomicspk_t *micspkstream;
-	audiodsp_t *dspstream;
-	audioaec_t *aecstream;
-	audioresize_t *resizestream;
-	audiortp_t *rtpstream;
-	audiocodec_t *codecstream;
-	rtp_session_t *rtpsess;
-
-	struct 
-	{
-		audioresize_t *resizestream;
-		audiortp_t *rtpstream;
-		audiocodec_t *codecstream;
-		rtp_session_t *rtpsess;
-		int state;
-		audio_session_remote_recording_conf_t conf;
-	}record;
-};
-
-static int phonemedia_stop(void *object);
-
-static int phonemedia_create(audio_session_t *session, const audio_session_phonemedia_conf_t *conf, audio_phonemedia_t **p_media)
-{
-	audio_phonemedia_t *media = ZALLOC_T(audio_phonemedia_t);
-	if (media) {
-		memcpy(&media->conf, conf, sizeof(audio_session_phonemedia_conf_t));
-		media->owner = session;
-		*p_media = media;
-	}
-	return 0;
-}
-
-static int phonemedia_on_remote_recording(audio_phonemedia_t *media)
-{
-	int rc = 0;
-	audio_session_t *session = media->owner;
-	assert(media->record.state);
-
-	audiocontext_remove_driver(media->context, &media->bridge->base);
-	{
-		audio_session_remote_recording_conf_t *conf = &media->record.conf;
-		int clock = REC_COMMON_AUDIO_CLOCK;
-		int ptime = REC_COMMON_AUDIO_FRAME_PTIME;
-		apr_status_t status;
-		rc = rtp_session_create2(conf->local_rtp_ip, conf->local_rtp_port, 2, &media->record.rtpsess);
-		if (rc != 0)
-			goto on_error;
-		rtp_session_reset2(media->record.rtpsess, RTP_SESSION_FLAG_SENDONLY|RTP_SESSION_FLAG_NO_RTCP, conf->remote_rtp_ip, conf->remote_rtp_port, conf->remote_rtp_port+1);
-		status = audioresize_create(media->pool, media->engine, FRAME_TIME*2*clock/1000, ptime*2*clock/1000, FRAME_TIME*2*clock/1000, ptime*2*clock/1000, &media->record.resizestream);
-		if (status != APR_SUCCESS)
-			goto on_error;
-		status = audiocodec_create(media->pool, media->engine, "G729", clock, FRAME_TIME, AUDIO_CODEC_OPT_ENCODE_WRITE, &media->record.codecstream);
-		if (status != APR_SUCCESS)
-			goto on_error;
-		status = audiortp_create(media->pool, media->engine, media->record.rtpsess, &media->record.rtpstream);
-		if (status != APR_SUCCESS)
-			goto on_error;
-		{
-			int param;
-			param = clock;
-			audiortp_set_param(media->record.rtpstream, AUDIO_RTP_FLAG_SEND_CLOCK, &param);
-			audiortp_set_param(media->record.rtpstream, AUDIO_RTP_FLAG_RECV_CLOCK, &param);
-			param = REC_COMMON_AUDIO_PT;
-			audiortp_set_param(media->record.rtpstream, AUDIO_RTP_FLAG_SEND_PT, &param);
-			audiortp_set_param(media->record.rtpstream, AUDIO_RTP_FLAG_RECV_PT, &param);
-			param = ptime;
-			audiortp_set_param(media->record.rtpstream, AUDIO_RTP_FLAG_SEND_PTIME, &param);
-			audiortp_set_param(media->record.rtpstream, AUDIO_RTP_FLAG_RECV_PTIME, &param);
-			audiortp_init(media->record.rtpstream);
-		}
-		audiostream_connect_pipeline(STREAM_DIR_WRITE, &media->record.resizestream->base, &media->record.codecstream->base, &media->record.rtpstream->base, NULL);
-		audiobridge_set_recorder(media->bridge, &media->record.resizestream->base);
-on_error:
-		if (status != APR_SUCCESS) {
-			Dbg("create remote recording objects failed!");
-			rc = Error_Resource;
-		}
-	}
-	audiocontext_add_driver(media->context, &media->bridge->base);
-	
-	return rc;
-}
-
-static int phonemedia_start(audio_phonemedia_t *media)
-{
-	audio_session_t *session = media->owner;
-	apr_status_t status;
-	int rc;
-	int opt_micspk;
-	int in_dev;
-	int out_dev;
-	const char *codec;
-
-	in_dev = translate_id(TRUE, session->conf.in_dev[media->conf.dev_type]);
-	if (in_dev < 0) {
-		Dbg("in_dev invalid! id:%d", in_dev);
-		return Error_Param;
-	}
-	out_dev = translate_id(FALSE, session->conf.out_dev[media->conf.dev_type]);
-	if (out_dev < 0) {
-		Dbg("out_dev invalid! id:%d", out_dev);
-		return Error_Param;
-	}
-
-	opt_micspk = AMS_OPT_AS_STREAM;
-	if (media->conf.dir & DIR_TX) {
-		opt_micspk |= AMS_OPT_PLAY;
-	}
-	if (media->conf.dir &DIR_RX) {
-		opt_micspk |= AMS_OPT_RECORD;
-	}
-
-	switch (media->conf.local_pt) {
-	case 0:
-		codec = "PCMU";
-		if (media->conf.local_ptime == 0)
-			media->conf.local_ptime = 20;
-		if (media->conf.remote_ptime == 0)
-			media->conf.remote_ptime = 20;
-		break;
-#if 0
-	case 4:
-		codec = "G723";
-		if (media->conf.local_ptime == 0)
-			media->conf.local_ptime = 30;
-		if (media->conf.remote_ptime == 0)
-			media->conf.remote_ptime = 30;
-		break;
-#endif
-	case 8: 
-		codec = "PCMA";
-		if (media->conf.local_ptime == 0)
-			media->conf.local_ptime = 20;
-		if (media->conf.remote_ptime == 0)
-			media->conf.remote_ptime = 20;
-		break;
-	case 18:
-		codec = "G729";
-		if (media->conf.local_ptime == 0)
-			media->conf.local_ptime = 20;
-		if (media->conf.remote_ptime == 0)
-			media->conf.remote_ptime = 20;
-		break;
-	default:
-		codec = NULL;
-		break;
-	}
-	if (codec == NULL)
-		goto on_error;
-	assert(media->conf.local_ptime == media->conf.remote_ptime);
-
-	status = apr_pool_create(&media->pool, NULL);
-	if (status != APR_SUCCESS) {
-		Dbg("create pool failed!");
-		return Error_Resource;
-	}
-
-	status = audioengine_create(media->pool, &media->engine);
-	if (status != APR_SUCCESS) {
-		Dbg("create audio engine failed!");
-		goto on_error;
-	}
-
-	status = audioengine_start(media->engine);
-	if (status != APR_SUCCESS) {
-		goto on_error;
-	}
-
-	rc = rtp_session_create2(media->conf.local_rtp_ip, media->conf.local_rtp_port, 
-		2, &media->rtpsess);
-	if (rc != 0) {
-		goto on_error;
-	}
-	rc = rtp_session_reset2(media->rtpsess, media->conf.dir, media->conf.remote_rtp_ip, 
-		media->conf.remote_rtp_port, media->conf.remote_rtp_port+1);
-	if (rc != 0) {
-		goto on_error;
-	}
-	
-	status = audiobridge_create(media->pool, media->engine, &media->bridge);
-	if (status != APR_SUCCESS)
-		goto on_error;
-	status = apr_pool_create(&media->micspk_pool, media->pool);
-	if (status != APR_SUCCESS)
-		goto on_error;
-	status = audiomicspk_create(media->micspk_pool, media->engine, opt_micspk, 
-		AUDIO_CLOCK, in_dev, out_dev, &media->micspkstream);
-	if (status != APR_SUCCESS)
-		goto on_error;
-	status = audiodsp_create(media->pool, media->engine, AUDIO_DSP_AGC|AUDIO_DSP_DENOISE, 
-		AUDIO_DSP_AGC, AUDIO_CLOCK, &media->dspstream);
-	if (status != APR_SUCCESS)
-		goto on_error;
-	status = audioaec_create(media->pool, media->engine, AUDIO_CLOCK, FRAME_TIME, 
-		AUDIO_AEC_OPT_READ_AS_CAPTURE, &media->aecstream);
-	if (status != APR_SUCCESS)
-		goto on_error;
-	status = audioresize_create(media->pool, media->engine, FRAME_TIME*2*AUDIO_CLOCK/1000, 
-		media->conf.remote_ptime*2*AUDIO_CLOCK/1000, FRAME_TIME*2*AUDIO_CLOCK/1000, 
-		media->conf.local_ptime*2*AUDIO_CLOCK/1000, &media->resizestream);
-	if (status != APR_SUCCESS)
-		goto on_error;
-	status = audiocodec_create(media->pool, media->engine, codec, AUDIO_CLOCK, FRAME_TIME, 
-		AUDIO_CODEC_OPT_ENCODE_WRITE, &media->codecstream);
-	if (status != APR_SUCCESS)
-		goto on_error;
-	status = audiortp_create(media->pool, media->engine, media->rtpsess, &media->rtpstream);
-	if (status != APR_SUCCESS)
-		goto on_error;
-
-	{
-		int param;
-		param = AUDIO_CLOCK;
-		audiortp_set_param(media->rtpstream, AUDIO_RTP_FLAG_SEND_CLOCK, &param);
-		audiortp_set_param(media->rtpstream, AUDIO_RTP_FLAG_RECV_CLOCK, &param);
-		param = media->conf.local_pt;
-		audiortp_set_param(media->rtpstream, AUDIO_RTP_FLAG_SEND_PT, &param);
-		param = media->conf.remote_pt;
-		audiortp_set_param(media->rtpstream, AUDIO_RTP_FLAG_RECV_PT, &param);
-		param = media->conf.local_dtmf_pt;
-		audiortp_set_param(media->rtpstream, AUDIO_RTP_FLAG_SEND_DTMF, &param);
-		param = media->conf.remote_dtmf_pt;
-		audiortp_set_param(media->rtpstream, AUDIO_RTP_FLAG_RECV_DTMF, &param);
-		param = media->conf.local_ptime;
-		audiortp_set_param(media->rtpstream, AUDIO_RTP_FLAG_SEND_PTIME, &param);
-		param = media->conf.remote_ptime;
-		audiortp_set_param(media->rtpstream, AUDIO_RTP_FLAG_RECV_PTIME, &param);
-
-		audiortp_init(media->rtpstream);
-	}
-
-	if (media->conf.dir == DIR_TX) {
-		audiostream_connect_pipeline(STREAM_DIR_READ, &media->aecstream->base, &media->dspstream->base, &media->micspkstream->base, NULL);
-		audiobridge_set_leg(media->bridge, AUDIO_BRIDGE_LEG_LEFT, &media->aecstream->base);
-		audiostream_connect_pipeline(STREAM_DIR_WRITE, &media->resizestream->base, &media->codecstream->base, &media->rtpstream->base, NULL);
-		audiobridge_set_leg(media->bridge, AUDIO_BRIDGE_LEG_RIGHT, &media->resizestream->base);
-	} else if (media->conf.dir == DIR_RX) {
-		audiostream_connect_pipeline(STREAM_DIR_WRITE, &media->micspkstream->base, NULL);
-		audiostream_connect_pipeline(STREAM_DIR_READ, &media->resizestream->base, &media->codecstream->base, &media->rtpstream->base, NULL);
-		audiobridge_set_leg(media->bridge, AUDIO_BRIDGE_LEG_LEFT, &media->micspkstream->base);
-		audiobridge_set_leg(media->bridge, AUDIO_BRIDGE_LEG_RIGHT, &media->resizestream->base);
-	} else {
-		audiostream_connect_pipeline(STREAM_DIR_BOTH, &media->resizestream->base, &media->codecstream->base, &media->rtpstream->base, NULL);
-		audiobridge_set_leg(media->bridge, AUDIO_BRIDGE_LEG_RIGHT, &media->resizestream->base);
-		audiostream_connect_pipeline(STREAM_DIR_BOTH, &media->aecstream->base, &media->dspstream->base, &media->micspkstream->base, NULL);
-		audiobridge_set_leg(media->bridge, AUDIO_BRIDGE_LEG_LEFT, &media->aecstream->base);
-	}
-
-	status = audiocontext_create(media->pool, media->engine, &media->context);
-	if (status != APR_SUCCESS)
-		goto on_error;
-
-	audiocontext_add_driver(media->context, &media->bridge->base);
-	audioengine_start_context(media->engine, media->context);
-
-	if (media->record.state) {
-		rc = phonemedia_on_remote_recording(media);
-		if (rc != 0) {
-			goto on_error;
-		}
-	}
-
-	return 0;
-
-on_error:
-	phonemedia_stop(media);
-	return Error_Resource;
-}
-
-static int phonemedia_stop(void *object)
-{
-	audio_phonemedia_t *media = (audio_phonemedia_t*)object;
-	if (media->context) {
-		audioengine_stop_context(media->engine, media->context);
-		audiocontext_remove_driver(media->context, &media->bridge->base);
-		audiocontext_destroy(media->context);
-		media->context = NULL;
-	}
-	if (media->engine) {
-		audioengine_stop(media->engine);
-		audioengine_destroy(media->engine);
-		media->engine = NULL;
-	}
-	if (media->bridge) {
-		audiobridge_destroy(media->bridge);
-		media->bridge = NULL;
-	}
-	if (media->resizestream) {
-		audioresize_destroy(media->resizestream);
-		media->resizestream = NULL;
-	}
-	if (media->codecstream) {
-		audiocodec_destroy(media->codecstream);
-		media->codecstream = NULL;
-	}
-	if (media->rtpstream) {
-		audiortp_destroy(media->rtpstream);
-		media->rtpstream = NULL;
-	}
-	if (media->rtpsess) {
-		rtp_session_destroy(media->rtpsess);
-		media->rtpsess = NULL;
-	}
-	if (media->aecstream) {
-		audioaec_destroy(media->aecstream);
-		media->aecstream = NULL;
-	}
-	if (media->dspstream) {
-		audiodsp_destroy(media->dspstream);
-		media->dspstream = NULL;
-	}
-	if (media->micspkstream) {
-		audiomicspk_destroy(media->micspkstream);
-		media->micspkstream = NULL;
-		apr_pool_destroy(media->micspk_pool);
-		media->micspk_pool = NULL;
-	}
-	if (media->record.state) {
-		if (media->record.codecstream) {
-			audiocodec_destroy(media->record.codecstream);
-			media->record.codecstream = NULL;
-		}
-		if (media->record.resizestream) {
-			audioresize_destroy(media->record.resizestream);
-			media->record.resizestream = NULL;
-		}
-		if (media->record.rtpstream) {
-			audiortp_destroy(media->record.rtpstream);
-			media->record.rtpstream = NULL;
-			rtp_session_destroy(media->record.rtpsess);
-			media->record.rtpsess = NULL;
-		}
-		media->record.state = 0;
-	}
-	if (media->pool) {
-		apr_pool_destroy(media->pool);
-		media->pool = NULL;
-	}
-	return 0;
-}
-
-static void phonemedia_destroy(void *object)
-{
-	audio_phonemedia_t *media = (audio_phonemedia_t *)object;
-	free(media);
-}
-
-static int phonemedia_chang_dev(void *object, e_dev_type t)
-{
-	audio_phonemedia_t *media = (audio_phonemedia_t *)object;
-	audio_session_t *session = media->owner;
-	int opt_micspk;
-	int in_dev;
-	int out_dev;
-
-	in_dev = translate_id(TRUE, session->conf.in_dev[media->conf.dev_type]);
-	if (in_dev < 0) {
-		Dbg("in_dev invalid! id:%d", in_dev);
-		return Error_Param;
-	}
-	out_dev = translate_id(FALSE, session->conf.out_dev[media->conf.dev_type]);
-	if (out_dev < 0) {
-		Dbg("out_dev invalid! id:%d", out_dev);
-		return Error_Param;
-	}
-
-	opt_micspk = AMS_OPT_AS_STREAM;
-	if (media->conf.dir & DIR_TX) {
-		opt_micspk |= AMS_OPT_PLAY;
-	}
-	if (media->conf.dir &DIR_RX) {
-		opt_micspk |= AMS_OPT_RECORD;
-	}
-
-	if (media->pool) {
-		//apr_status_t status;
-		audiocontext_remove_driver(media->context, &media->bridge->base);
-		audiomicspk_destroy(media->micspkstream);
-		media->micspkstream = NULL;
-		apr_pool_destroy(media->micspk_pool);
-		apr_pool_create(&media->micspk_pool, media->pool);
-		audiomicspk_create(media->micspk_pool, media->engine, opt_micspk, AUDIO_CLOCK, 
-			in_dev, out_dev, &media->micspkstream);
-		if (media->conf.dir == DIR_TX) {
-			audiostream_connect_pipeline(STREAM_DIR_READ, &media->aecstream->base, &media->dspstream->base, &media->micspkstream->base, NULL);
-			audiobridge_set_leg(media->bridge, AUDIO_BRIDGE_LEG_LEFT, &media->aecstream->base);
-			audiostream_connect_pipeline(STREAM_DIR_WRITE, &media->resizestream->base, &media->codecstream->base, &media->rtpstream->base, NULL);
-			audiobridge_set_leg(media->bridge, AUDIO_BRIDGE_LEG_RIGHT, &media->resizestream->base);
-		} else if (media->conf.dir == DIR_RX) {
-			audiostream_connect_pipeline(STREAM_DIR_WRITE, &media->micspkstream->base, NULL);
-			audiostream_connect_pipeline(STREAM_DIR_READ, &media->resizestream->base, &media->codecstream->base, &media->rtpstream->base, NULL);
-			audiobridge_set_leg(media->bridge, AUDIO_BRIDGE_LEG_LEFT, &media->micspkstream->base);
-			audiobridge_set_leg(media->bridge, AUDIO_BRIDGE_LEG_RIGHT, &media->resizestream->base);
-		} else {
-			audiostream_connect_pipeline(STREAM_DIR_BOTH, &media->resizestream->base, &media->codecstream->base, &media->rtpstream->base, NULL);
-			audiobridge_set_leg(media->bridge, AUDIO_BRIDGE_LEG_RIGHT, &media->resizestream->base);
-			audiostream_connect_pipeline(STREAM_DIR_BOTH, &media->aecstream->base, &media->dspstream->base, &media->micspkstream->base, NULL);
-			audiobridge_set_leg(media->bridge, AUDIO_BRIDGE_LEG_LEFT, &media->aecstream->base);
-		}
-		audiocontext_add_driver(media->context, &media->bridge->base);
-		return 0;
-	} else {
-		return Error_NotInit;
-	}
-	
-	return Error_Unexpect;
-}
-
-static int phonemedia_start_remote_recording(void *object, const audio_session_remote_recording_conf_t *conf)
-{
-	audio_phonemedia_t *media = (audio_phonemedia_t *)object;
-	media->record.state = TRUE;
-	memcpy(&media->record.conf, conf, sizeof(audio_session_remote_recording_conf_t));
-	if (media->pool) {
-		int rc = phonemedia_on_remote_recording(media);
-		if (rc != 0) {
-			Dbg("start remote recording failed!");
-		}
-		return rc;
-	}
-	return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-//// audio session
-
-int audio_session_create(const audio_session_conf_t *conf, audio_session_t **p_session)
-{
-	audio_session_t *session = ZALLOC_T(audio_session_t);
-	if (session) {
-		memcpy(&session->conf, conf, sizeof(audio_session_conf_t));
-		session->m_audio_shm_q = new Clibaudioqueue(conf->shm_audioq_name);
-		*p_session = session;
-		return 0;
-	}
-	return Error_Resource;
-}
-int audio_session_start_recording(audio_session_t *session)
-{
-	if (!session->object) {
-		audio_recorder_t *recorder;
-		int rc = recorder_create(session, &recorder);
-		if (rc == 0) {
-			session->object = recorder;
-			session->stop = &recorder_stop;
-			session->destroy = &recorder_destroy;
-			rc = recorder_start(recorder);
-			if (rc != 0) {
-				Dbg("recorder start failed!");
-				recorder_destroy(recorder);
-				session->object = NULL;
-			}
-		}
-		return rc;
-	} else {
-		return Error_Duplication;
-	}
-}
-int audio_session_start_phonemedia(audio_session_t *session, const audio_session_phonemedia_conf_t *conf)
-{
-	if (!session->object) {
-		audio_phonemedia_t *media;
-		int rc = phonemedia_create(session, conf, &media);
-		if (rc == 0) {
-			session->object = media;
-			session->stop = &phonemedia_stop;
-			session->destroy = &phonemedia_destroy;
-			rc = phonemedia_start(media);
-			if (rc != 0) {
-				Dbg("recorder start failed!");
-				phonemedia_destroy(media);
-				session->object = NULL;
-			}
-		}
-		return rc;
-	} else {
-		return Error_Duplication;
-	}
-}
-int audio_session_stop(audio_session_t *session)
-{
-	if (session->object) {
-		int rc = session->stop(session->object);
-		if (rc == 0) {
-			session->destroy(session->object);
-			session->object = NULL;
-		} else {
-			Dbg("session stop failed!");
-		}
-		return rc;
-	} else {
-		return Error_NotInit;
-	}
-}
-void audio_session_destroy(audio_session_t *session)
-{
-	delete session->m_audio_shm_q;
-	free(session);
-}
-int audio_session_change_dev(audio_session_t *session, e_dev_type t)
-{
-	return phonemedia_chang_dev(session->object, t);
-}
-int audio_session_start_remote_recording(audio_session_t *session, const audio_session_remote_recording_conf_t *conf)
-{
-	return phonemedia_start_remote_recording(session->object, conf);
-}
-
-static void __stdcall __audio_log_func(int level, const char *s)
-{
-	Dbg(s);
-}
-int audio_lib_init()
-{
-	audio_log_set_func(&__audio_log_func);
-
-	int rc = audioframework_init();
-	if (rc != 0) {
-		return Error_Resource;
-	} else {
-		int icnt, ocnt;
-		audio_log_set_func(NULL);
-		rc = audio_get_dev_count(&icnt, &ocnt);
-		if (rc == 0) {
-			int i;
-			Dbg("audio input devices(%d):", icnt);
-			for (i = 0; i < icnt; ++i) {
-				CSimpleStringA str = audio_get_dev_name(true, i);
-				Dbg("%d = %s", i, (LPCSTR)str);
-			}
-			Dbg("audio output devices(%d):", ocnt);
-			for (i = 0; i < ocnt; ++i) {
-				CSimpleStringA str = audio_get_dev_name(false, i);
-				Dbg("%d = %s", i, (LPCSTR)str);
-			}
-		}
-		audio_log_set_func(&__audio_log_func);
-	}
-	return 0;
-}
-void audio_lib_deinit()
-{
-	audioframework_term();
-}
-int audio_get_dev_count(int *in_cnt, int *out_cnt)
-{
-	int icnt = 0, ocnt = 0;
-	int cnt = Pa_GetDeviceCount();
-	for (int i = 0; i < cnt; ++i) {
-		const PaDeviceInfo *info = Pa_GetDeviceInfo(i);
-		if (info->maxInputChannels)
-			icnt ++;
-		if (info->maxOutputChannels)
-			ocnt ++;
-	}
-	if (in_cnt)
-		*in_cnt = icnt;
-	if (out_cnt)
-		*out_cnt = ocnt;
-	return 0;
-}
-CSimpleStringA audio_get_dev_name(bool in_direction, int idx)
-{
-	audio_log_set_func(NULL);
-	int cnt = Pa_GetDeviceCount();
-	int ii, i;
-	for (i = 0, ii = 0; i < cnt; ++i) {
-		const PaDeviceInfo *info = Pa_GetDeviceInfo(i);
-		if (in_direction) {
-			if (info->maxInputChannels) {
-				if (idx == ii) {
-					audio_log_set_func(__audio_log_func);
-					return CSimpleStringA(info->name);
-				}
-				ii++;
-			}
-		} else {
-			if (info->maxOutputChannels) {
-				if (idx == ii) {
-					audio_log_set_func(__audio_log_func);
-					return CSimpleStringA(info->name);
-				}
-				ii++;
-			}
-		}
-	}
-	audio_log_set_func(__audio_log_func);
-	return CSimpleStringA();
-}
-static int translate_id(int in_direction, int idx)
-{
-	int i, n, ii;
-	audio_log_set_func(NULL);
-	n = Pa_GetDeviceCount();
-	for (i = 0, ii = 0; i < n; ++i) {
-		const PaDeviceInfo *info = Pa_GetDeviceInfo(i);
-		if (in_direction) {
-			if (info->maxInputChannels) {
-				if (ii == idx) {
-					audio_log_set_func(__audio_log_func);
-					return i;
-				}
-				ii++;
-			}
-		} else {
-			if (info->maxOutputChannels) {
-				if (ii == idx) {
-					audio_log_set_func(__audio_log_func);
-					return i;
-				}
-				ii++;
-			}
-		}
-	}
-	audio_log_set_func(__audio_log_func);
-	return -1;
-}

+ 0 - 66
Module/mod_mediacontroller/audio_session.h

@@ -1,66 +0,0 @@
-#ifndef MEDIACONTROLLER_AUDIO_H
-#define MEDIACONTROLLER_AUDIO_H
-
-#pragma once
-
-enum e_dev_type
-{
-	DEV_PICKUP,
-	DEV_HANDFREE, 
-};
-
-typedef struct audio_session_conf_t {
-	int in_dev[2];
-	int out_dev[2];
-	char shm_audioq_name[32];
-}audio_session_conf_t;
-
-enum e_media_dir 
-{
-	DIR_NONE = 0,
-	DIR_TX = 1, 
-	DIR_RX = 2,
-	DIR_BOTH = 3,
-};
-
-typedef struct audio_session_phonemedia_conf_t {
-	int dir;
-	unsigned long local_rtp_ip;
-	int local_rtp_port;
-	unsigned long remote_rtp_ip;
-	int remote_rtp_port;
-	int local_ptime;
-	int remote_ptime;
-	int local_pt;
-	int remote_pt;
-	int local_dtmf_pt;
-	int remote_dtmf_pt;
-	e_dev_type dev_type;
-	//...
-}audio_session_phonemedia_conf_t;
-
-typedef struct audio_session_remote_recording_conf_t {
-	unsigned long local_rtp_ip;
-	int local_rtp_port;
-	unsigned long remote_rtp_ip;
-	int remote_rtp_port;
-	int ptime;
-}audio_session_remote_recording_conf_t;
-
-typedef struct audio_session_t audio_session_t;
-
-int audio_session_create(const audio_session_conf_t *conf, audio_session_t **p_session);
-int audio_session_start_recording(audio_session_t *session);
-int audio_session_start_phonemedia(audio_session_t *session, const audio_session_phonemedia_conf_t *conf);
-int audio_session_stop(audio_session_t *session);
-void audio_session_destroy(audio_session_t *session);
-int audio_session_change_dev(audio_session_t *session, e_dev_type t);
-int audio_session_start_remote_recording(audio_session_t *session, const audio_session_remote_recording_conf_t *conf);
-
-int audio_lib_init();
-void audio_lib_deinit();
-
-int audio_get_dev_count(int *in_cnt, int *out_cnt);
-CSimpleStringA audio_get_dev_name(bool in_direction, int idx);
-
-#endif // MEDIACONTROLLER_AUDIO_H

+ 4 - 3
Module/mod_mediacontroller/capture.cpp

@@ -2,19 +2,20 @@
 
 #include <locale.h>
 #include <memutil.h>
+#include <objbase.h>
 #include <md5.h>
 #include <ipp.h>
 #include <intrin.h>
 #include "y2k_time.h"
-#include "rec_common.h"
-#include "videohorflip.h"
+#include "../../Other/include/rvc_media_common.h"
+#include "../../Other/libvideohorflip/videohorflip.h"
 #include "Event.h"
 #include "capture.h"
 using namespace MediaController;
 
 #define av_always_inline __inline
 #define inline __inline
-#include "video_common/ffmpeg_api_cpp_adapter.h"
+#include "../../Other/libvideoframework/video_common/ffmpeg_api_cpp_adapter.h"
 
 static int Bin2Str(unsigned char *x, int xlen, char *str, int str_size)
 {

+ 4 - 4
Module/mod_mediacontroller/capture.h

@@ -1,10 +1,10 @@
 #pragma once
 
 #include "SpBase.h"
-#include "..\EventCode.h"
-#include "videoframework.h"
-#include "libaudioqueue.h"
-#include "libvideoqueue.h"
+#include "../include/EventCode.h"
+#include "../../Other/libvideoframework/videoframework.h"
+#include "../../Other/libaudioqueue/libaudioqueue.h"
+#include "../../Other/libvideoqueue/libvideoqueue.h"
 #include <portaudio.h>
 
 #ifndef INT64_C

+ 0 - 58
Module/mod_mediacontroller/misc.c

@@ -1,58 +0,0 @@
-#include "precompile.h"
-#include "videortp.h"
-#include "videocap.h"
-#include "videocommon.h"
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <assert.h>
-#include <malloc.h>
-
-#define av_always_inline __inline
-#define inline __inline
-
-#include <stdint.h>
-#include <libavutil\avutil.h>
-#include <libavcodec\avcodec.h>
-#include <libswscale\swscale.h>
-
-void Dbg(const char *str, ...);
-extern void vDbg(const char *str, va_list list);
-
-static void av_log_cb(void*ptr, int level, const char*fmt, va_list list)
-{
-	vDbg(fmt, list);
-}
-
-int video_lib_init()
-{
-	CoInitialize(NULL);
-
-	{
-		int i, n;
-
-		n = videocap_get_device_count();
-		for (i = 0; i < n; ++i) {
-			WCHAR tmp[128];
-			char t[128];
-			videocap_get_device_name(i, tmp, ARRAYSIZE(tmp));
-			WideCharToMultiByte(CP_ACP, 0, tmp, -1, t, sizeof(t), 0, NULL);
-			Dbg("%d = %s", i, t);
-		}
-	}
-
-	videoframework_init();
-
-	av_log_set_callback(&av_log_cb);
-	//av_log_set_level(AV_LOG_DEBUG);
-	av_log_set_level(AV_LOG_QUIET);
-
-	return 0;
-}
-
-void video_lib_deinit()
-{
-	CoUninitialize();
-	videoframework_term();
-}
-

+ 12 - 13
Module/mod_mediacontroller/mod_mediacontroller.cpp

@@ -4,32 +4,31 @@
 #include "y2k_time.h"
 #include "capture.h"
 #include "Event.h"
-#include "iaudiorenderinterface.h"
-#include "..\EventCode.h"
+#include "../../Other/libaudiorender/iaudiorenderinterface.h"
+#include "../include/EventCode.h"
 
-#include "..\\mod_snapshot\\Event.h"
+#include "../mod_snapshot/Event.h"
 // id:0x208
-#include "..\mod_Assistantchannel\AssistantChannel_client_g.h"
+#include "../mod_Assistantchannel/AssistantChannel_client_g.h"
 using namespace AssistantChannel;
 
-#include "..\mod_Assistantchannel\chan_protocol.h"
+#include "../mod_Assistantchannel/chan_protocol.h"
 
-#include "..\mod_selfchecker\SelfChecker_client_g.h"
-#include "..\mod_selfchecker\SelfChecker_def_g.h"
-#include "..\ModuleMix.h"
-#include "..\EventCode.h"
+#include "../mod_selfchecker/SelfChecker_client_g.h"
+#include "../mod_selfchecker/SelfChecker_def_g.h"
+#include "../include/ModuleMix.h"
 #include "MediaController_server_g.h"
 #include "MediaController_msg_g.h"
 #include "ExternalCameraMsg.h"
 using namespace MediaController;
 using namespace SelfChecker;
 
-#include "..\mod_ScannerSet\ScannerSet_client_g.h"
-#include "..\mod_ScannerSet\ScannerSet_def_g.h"
+#include "../mod_ScannerSet/ScannerSet_client_g.h"
+#include "../mod_ScannerSet/ScannerSet_def_g.h"
 using namespace ScannerSet;
 
-#include "..\mod_CameraConfigManage\CameraConfigManage_client_g.h"
-#include "..\mod_CameraConfigManage\CameraConfigManage_def_g.h"
+#include "../mod_CameraConfigManage/CameraConfigManage_client_g.h"
+#include "../mod_CameraConfigManage/CameraConfigManage_def_g.h"
 using namespace CameraConfigManage;
 
 #define LOG_EVT_SELFCHECK_ASSISTANTCHANNEL_IDLE		0x50500001  //ЭÖúͨµÀÖØÆô

+ 0 - 130
Module/mod_mediacontroller/mod_mediacontroller.vcxproj

@@ -1,130 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
-  <PropertyGroup Label="Globals">
-    <ProjectGuid>{3D0D12A9-5556-40B7-9A5F-BD17D8490B1F}</ProjectGuid>
-    <Keyword>Win32Proj</Keyword>
-    <RootNamespace>mod_mediacontroller</RootNamespace>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-    <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>Windows7.1SDK</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-    <CharacterSet>MultiByte</CharacterSet>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <Import Project="..\modmake.setting" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <LinkIncremental>true</LinkIncremental>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <LinkIncremental>false</LinkIncremental>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <ClCompile>
-      <PrecompiledHeader>
-      </PrecompiledHeader>
-      <WarningLevel>Level3</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_MEDIACONTROLLER_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>$(FrameworkHeadRoot)\Common;$(FrameworkHeadRoot)\libtoolkit;$(ThirdPartyHeadRoot)\portaudio\include;$(ThirdPartyHeadRoot)\IPP;$(OtherHeadPath)\libvideoframework;$(OtherHeadPath)\libvideoqueue;$(OtherHeadPath)\libvideohorflip;$(OtherHeadPath)\libaudioqueue;$(ThirdPartyHeadRoot)\ffmpeg_4.1\include;$(OtherHeadPath)\libaudiorender;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>$(FrameworkLib)\SpBase.lib;$(FrameworkLib)\libtoolkit.lib;$(ThirdPartyLib)\libippwrap.lib;$(ThirdPartyLib)\avcodec.lib;$(ThirdPartyLib)\avutil.lib;$(ThirdPartyLib)\swscale.lib;$(ThirdPartyLib)\portaudio_x86.lib;ws2_32.lib;strmiids.lib;winmm.lib;Vfw32.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <!--<AdditionalDependencies>libapr-1.lib;liba8k.lib;avcodec.lib;avutil.lib;swscale.lib;ws2_32.lib;;;%(AdditionalDependencies)</AdditionalDependencies>-->
-      <!--<AdditionalLibraryDirectories>..\..\ThirdParty\apr\Release\;..\..\ThirdParty\liba8k\lib\;..\..\ThirdParty\ffmpeg_1.2.5\lib\;..\..\ThirdParty\portaudio\build\msvc\win32\Release\;..\..\ThirdParty\spandsp-0.0.6\src\Release\;..\..\ThirdParty\speex-1.2rc1\lib\;..\..\ThirdParty\libippwrap\release\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>-->
-    </Link>
-    <PostBuildEvent />
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <PrecompiledHeader>
-      </PrecompiledHeader>
-      <Optimization>MaxSpeed</Optimization>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_MEDIACONTROLLER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>$(FrameworkHeadRoot)\Common;$(FrameworkHeadRoot)\libtoolkit;$(ThirdPartyHeadRoot)\portaudio\include;$(ThirdPartyHeadRoot)\IPP;$(OtherHeadPath)\libvideoframework;$(OtherHeadPath)\libvideoqueue;$(OtherHeadPath)\libvideohorflip;$(OtherHeadPath)\libaudioqueue;$(ThirdPartyHeadRoot)\ffmpeg_1.0.0\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>$(FrameworkLib)\SpBase.lib;$(FrameworkLib)\libtoolkit.lib;$(ThirdPartyLib)\libippwrap.lib;$(ThirdPartyLib)\avcodec-54.lib;$(ThirdPartyLib)\swscale-2.lib;$(ThirdPartyLib)\portaudio_x86.lib;ws2_32.lib;strmiids.lib;winmm.lib;Vfw32.lib;%(AdditionalDependencies)</AdditionalDependencies>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemGroup>
-    <ClCompile Include="$(FrameworkHeadRoot)\Common\stdafx.cpp">
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
-    </ClCompile>
-    <ClCompile Include="capture.cpp" />
-    <ClCompile Include="mod_mediacontroller.cpp" />
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="$(FrameworkHeadRoot)\Common\stdafx.h" />
-    <ClInclude Include="capture.h" />
-    <ClInclude Include="Event.h" />
-    <ClInclude Include="ExternalCameraMsg.h" />
-    <ClInclude Include="MediaController_client_g.h" />
-    <ClInclude Include="MediaController_def_g.h" />
-    <ClInclude Include="MediaController_msg_g.h" />
-    <ClInclude Include="MediaController_server_g.h" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\..\Other\libaudioframework\libaudioframework.vcxproj">
-      <Project>{27a0e22d-a039-46c8-a3e4-b0f290d8fe5e}</Project>
-    </ProjectReference>
-    <ProjectReference Include="..\..\Other\libaudioqueue\libaudioqueue.vcxproj">
-      <Project>{2ad3370e-8091-40a1-80ba-7db3aa809cda}</Project>
-    </ProjectReference>
-    <ProjectReference Include="..\..\Other\libaudiorender\libaudiorender.vcxproj">
-      <Project>{cfe73bba-505a-4a5b-b062-a3bb3d4a299a}</Project>
-    </ProjectReference>
-    <ProjectReference Include="..\..\Other\libvideoframework\libvideoframework.vcxproj">
-      <Project>{a03cf9de-36c7-4c86-8ce3-ad4d564f6341}</Project>
-    </ProjectReference>
-    <ProjectReference Include="..\..\Other\libvideohorflip\libvideohorflip.vcxproj">
-      <Project>{91736fa2-f047-4bdb-889b-d7f25f429601}</Project>
-    </ProjectReference>
-    <ProjectReference Include="..\..\Other\libvideoqueue\libvideoqueue.vcxproj">
-      <Project>{24312d88-f752-40c2-a1b9-a55eddd9791a}</Project>
-    </ProjectReference>
-  </ItemGroup>
-  <ItemGroup>
-    <ResourceCompile Include="..\..\Version.rc" />
-  </ItemGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-  <ImportGroup Label="ExtensionTargets">
-  </ImportGroup>
-</Project>

+ 0 - 59
Module/mod_mediacontroller/mod_mediacontroller.vcxproj.filters

@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup>
-    <Filter Include="Source Files">
-      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
-      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
-    </Filter>
-    <Filter Include="Header Files">
-      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
-      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
-    </Filter>
-    <Filter Include="Resource Files">
-      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
-      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
-    </Filter>
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="mod_mediacontroller.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="capture.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="$(FrameworkHeadRoot)\Common\stdafx.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="capture.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="Event.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="MediaController_client_g.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="MediaController_def_g.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="MediaController_msg_g.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="MediaController_server_g.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="ExternalCameraMsg.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="$(FrameworkHeadRoot)\Common\stdafx.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-  </ItemGroup>
-  <ItemGroup>
-    <ResourceCompile Include="..\..\Version.rc">
-      <Filter>Resource Files</Filter>
-    </ResourceCompile>
-  </ItemGroup>
-</Project>

+ 8 - 0
Module/mod_mediacontroller/stdafx.cpp

@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+// SpBase.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file

+ 0 - 671
Module/mod_mediacontroller/video_session.cpp

@@ -1,671 +0,0 @@
-#include "stdafx.h"
-#include "SpBase.h"
-#include "video_session.h"
-#include "videoframework.h"
-#include "memutil.h"
-#include "libvideoqueue.h"
-
-#include <videocommon.h>
-#include <videoutil.h>
-#include <videoplayer.h>
-#include <videocap.h>
-#include <videortp.h>
-#include <videoclock.h>
-
-#include "rec_common.h"
-
-#define WNDCLS_NAME	"mediacontroller_video"
-
-struct video_session_t
-{
-	video_session_conf_t conf;
-	//...
-	void *object;
-	Clibvideoqueue *video_shm_q;
-	void (*destroy)(video_session_t *session, void *object);
-	int (*stop)(video_session_t *session, void *object);
-
-};
-
-static int calc_capture_mode(int width, int height, int *mode)
-{
-	const struct {
-		int mode;
-		int width;
-		int height;
-	} modes [] = {
-		{VIDEOCAP_FRAME_SQCIF, VIDEOCAP_SQCIF_WIDTH, VIDEOCAP_SQCIF_HEIGHT},
-		{VIDEOCAP_FRAME_QQVGA, VIDEOCAP_QQVGA_WIDTH, VIDEOCAP_QQVGA_HEIGHT},
-		{VIDEOCAP_FRAME_QCIF, VIDEOCAP_QCIF_WIDTH, VIDEOCAP_QCIF_HEIGHT},
-		{VIDEOCAP_FRAME_QVGA, VIDEOCAP_QVGA_WIDTH, VIDEOCAP_QVGA_HEIGHT},
-		{VIDEOCAP_FRAME_CIF, VIDEOCAP_CIF_WIDTH, VIDEOCAP_CIF_HEIGHT},
-		{VIDEOCAP_FRAME_VGA, VIDEOCAP_VGA_WIDTH, VIDEOCAP_VGA_HEIGHT},
-		{VIDEOCAP_FRAME_4CIF, VIDEOCAP_4CIF_WIDTH, VIDEOCAP_4CIF_HEIGHT},
-		{VIDEOCAP_FRAME_SVGA, VIDEOCAP_SVGA_WIDTH, VIDEOCAP_SVGA_HEIGHT},
-	};
-	int i;
-	for (i = 0; i < array_size(modes); ++i) {
-		if (modes[i].width == width && modes[i].height == height) {
-			*mode = modes[i].mode;
-			return 0;
-		}
-	}
-	return Error_NotExist;
-}
-
-static int video_shm_enqueue(video_session_t *session, video_frame *frame)
-{
-	assert(frame->format == VIDEO_FORMAT_RGB24);
-	videoq_frame tmp_frm;
-	tmp_frm.data = frame->data[0];
-	tmp_frm.framesize = frame->width * frame->height * 3;
-	tmp_frm.format = VIDEOQ_FORMAT_RGB24;
-	tmp_frm.width = frame->width;
-	tmp_frm.height = frame->height;
-	if (!session->video_shm_q->InsertVideo(&tmp_frm)) {
-		Dbg("caution: insert shm video failed!");
-		return Error_Unexpect;
-	} else {
-		return Error_Succeed;
-	}
-#if 0
-	videoq_frame *frm;
-	try {
-		frm = new videoq_frame(); // this will delete at InsertVideo with return code TRUE
-		frm->data = new unsigned char[frame->linesize[0] * frame->height];
-	} catch (std::bad_alloc ex) {
-		return Error_Resource;
-	}	
-	memcpy(frm->data, frame->data[0], frame->linesize[0] * frame->height);
-	frm->format = VIDEOQ_FORMAT_RGB24;
-	frm->width = frame->width;
-	frm->height = frame->height;
-	frm->framesize = frm->width * frm->height * 3;
-	//Dbg("InsertVideo, fmt:%d, width:%d, height:%d, framesize:%d", frm->format, frm->width, frm->height, frm->framesize);
-	if (session->video_shm_q->InsertVideo(frm)) {
-		delete frm->data;
-		delete frm;
-		//Dbg("insert ok!");
-		return 0;
-	} else { // insert failed, we need to delete frm
-		delete frm->data;
-		delete frm;
-		Dbg("caution: insert shm video failed!");
-	}
-	return Error_Unexpect;
-#endif
-}
-
-typedef struct recorder_t
-{
-	videocap_t cap;
-	video_session_t *owner;
-}recorder_t;
-
-static void __dbg(void *user_data, const char *fmt, va_list arg)
-{
-	vDbg(fmt, arg);
-}
-
-static void recorder_cap_on_frame(void *user_data, video_frame *frame)
-{
-	recorder_t *recorder = (recorder_t*)user_data;
-	int rc = video_shm_enqueue(recorder->owner, frame);
-	if (rc != 0) {
-		Dbg("video frame enqueue shm failed! rc = %d", rc);
-	}
-}
-
-static int recorder_create(video_session_t *session, const void * /*conf*/, recorder_t **p_object)
-{
-	recorder_t *recorder = ZALLOC_T(recorder_t);
-	if (recorder) {
-		videocap_param param = {0};
-		int mode;
-		int rc;
-		rc = calc_capture_mode(REC_COMMON_VIDEO_RAW_WIDTH, REC_COMMON_VIDEO_RAW_HEIGHT, &mode);
-		if (rc == 0) {
-			Dbg("calc capture mode failed!");
-			goto on_error;
-		}
-		param.cap_mode = mode;
-		param.dev_id = session->conf.dev_id;
-		param.res_mode = mode;
-		param.fps = REC_COMMON_VIDEO_RAW_FPS;
-		param.frame_fmt = VIDEO_FORMAT_RGB24;
-		param.on_frame = &recorder_cap_on_frame;
-		param.option = 0;
-		//param.option = VIDEOCAP_OPT_EANBLE_RESIZE | VIDEOCAP_OPT_ENABLE_ASYNC_GRAB | VIDEOCAP_OPT_ENABLE_FLIP;
-		param.user_data = recorder;
-		rc = videocap_create(&recorder->cap, &param);
-		if (rc != 0) {
-			Dbg("create videocap object failed!");
-			goto on_error;
-		}
-		Dbg("create videocap object ok!");
-		recorder->owner = session;
-		*p_object = recorder;
-		return 0;
-	}
-on_error:
-	if (recorder) {
-		free(recorder);
-	}
-	return Error_Resource;
-}
-
-static void recorder_destroy(video_session_t *session, void *object)
-{
-	recorder_t *recorder = (recorder_t *)object;
-	videocap_destroy(recorder->cap);
-	free(recorder);
-	Dbg("destroy video capture!");
-}
-
-static int recorder_start(video_session_t *session, recorder_t *recorder)
-{
-	int rc = videocap_start(recorder->cap);
-	if (rc != 0) {
-		Dbg("start video capture failed!");
-		return Error_Resource;
-	}
-	Dbg("start video capture ok!");
-	return 0;
-}
-
-static int recorder_stop(video_session_t *session, void *object)
-{
-	recorder_t *recorder = (recorder_t *)object;
-	int rc = videocap_stop(recorder->cap);
-	if (rc != 0) {
-		Dbg("stop video capture failed!");
-		return Error_Resource;
-	}
-	Dbg("stop video capture ok!");
-	return 0;
-}
-
-typedef struct phonemedia_t
-{
-	videoplayer_t *player;
-	videocap_t cap;
-	videoclock_t clock;
-	videortp_t *rtp;
-
-	video_session_t *owner;
-
-	HANDLE ui_thread;
-	HANDLE ui_event;
-	HWND local_hwnd; // preview window
-	HWND remote_hwnd; // remote window
-
-	video_session_phonemedia_conf_t conf;
-}phonemedia_t;
-
-static void stop_video(phonemedia_t *media)
-{
-	if (media->clock) {
-		videoclock_stop(media->clock);
-		videoclock_destroy(media->clock);
-		media->clock = NULL;
-	}
-	if (media->cap) {
-		videocap_stop(media->cap);
-		videocap_destroy(media->cap);
-		media->cap = NULL;
-	}
-	if (media->rtp) {
-		videortp_stop(media->rtp);
-		videortp_destroy(media->rtp);
-		media->rtp = NULL;
-	}
-	if (media->player) {
-		videoplayer_destroy(media->player);
-		media->player = NULL;
-	}
-}
-
-static LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
-	phonemedia_t *media = (phonemedia_t*)GetWindowLongPtrA(hWnd, GWLP_USERDATA);
-
-	//assert(media);
-
-	switch (msg) {
-	case WM_DESTROY:
-		if (media->local_hwnd == hWnd) {
-			media->local_hwnd = 0;
-		} else if (media->remote_hwnd == hWnd) {
-			media->remote_hwnd = 0;
-		}
-		if (media->local_hwnd == 0 && media->remote_hwnd == 0) {
-			PostQuitMessage(0);
-		}
-		return 0;
-	case WM_ACTIVATE:
-	case WM_TOUCH:
-	case WM_GESTURE:
-		ReleaseCapture();
-		return 0;
-	case WM_MBUTTONDOWN:
-	case WM_MBUTTONUP:
-	case WM_MBUTTONDBLCLK:
-	case WM_LBUTTONDBLCLK:
-	case WM_LBUTTONDOWN:
-	case WM_LBUTTONUP:
-		OutputDebugStringA("mouse clicked!");
-		if (media->local_hwnd) {
-			//ReleaseCapture();
-		}
-		
-		return 0;
-	case WM_CLOSE:
-		stop_video(media);
-		DestroyWindow(media->local_hwnd);
-		DestroyWindow(media->remote_hwnd);
-		return 0;
-	default:
-		return DefWindowProc(hWnd, msg, wParam, lParam);
-	}
-}
-
-static int on_rx_frame(video_frame *frame, void *user_data)
-{
-	phonemedia_t *media = (phonemedia_t *)user_data;
-	int used = 0;
-	if (media->player) {
-		Dbg("rx frame, width=%d,height=%d", frame->width, frame->height);
-		int rc = videoplayer_queue_frame(media->player, frame, &video_frame_delete);
-		if (rc == 0) {
-			used = TRUE;
-		}
-	}
-	return used;
-}
-
-static void phonemedia_cap_on_frame_raw(void *user_data, video_frame *frame)
-{
-	phonemedia_t *media = (phonemedia_t*)user_data;
-#if 1
-	int rc = video_shm_enqueue(media->owner, frame);
-	if (rc != 0) {
-		Dbg("video frame enqueue shm failed! rc = %d", rc);
-	}
-#endif
-}
-
-static void get_frame(void *user_data, video_frame *frame)
-{
-	phonemedia_t *media = (phonemedia_t*)user_data;
-	videocap_get_frame(media->cap, frame);
-}
-
-static void put_frame(void *user_data, video_frame *frame)
-{
-	phonemedia_t *media = (phonemedia_t*)user_data;
-	static int i = 0;
-	if (i++ % 8 == 0) {
-		//DEBUG_TRACE("cap on frame tick = %d", GetTickCount());
-	}
-
-	if (media->rtp) {
-		videortp_send_frame(media->rtp, frame);
-	}
-}
-
-static int start_video(phonemedia_t *media)
-{
-	int rc;
-	video_session_t *session = media->owner;
-
-	rc = videoplayer_create(media->remote_hwnd, 
-		0,
-		0,
-		media->conf.remote_video_view_cx,
-		media->conf.remote_video_view_cy,
-		media->conf.remote_video_fps_num,
-		media->conf.remote_video_fps_den,
-		media->conf.remote_video_width,
-		media->conf.remote_video_height,
-		&media->player);
-	if (rc != 0) {
-		Dbg("create video player failed!");
-		return rc;
-	}
-
-	{
-		videortp_config_t config = {0};
-		config.fps_den = REC_COMMON_VIDEO_FPS_DEN;
-		config.fps_num = REC_COMMON_VIDEO_FPS_NUM;
-		config.capture_height = -1; // not use
-		config.capture_width = -1; // not use
-		config.dir = 3;
-		config.height = REC_COMMON_VIDEO_HEIGHT;
-		config.width = REC_COMMON_VIDEO_WIDTH;
-		config.local_ip = media->conf.local_rtp_ip;
-		config.local_pt = REC_COMMON_VIDEO_PT;
-		config.local_rtp_port = media->conf.local_rtp_port;
-		config.mtu = media->conf.mtu;
-		config.quant = media->conf.video_quant;
-		config.remote_ip = media->conf.remote_rtp_ip;
-		config.remote_pt = REC_COMMON_VIDEO_PT;
-		config.remote_rtp_port = media->conf.remote_rtp_port;
-		config.user_data = media;
-		config.bit_rate = media->conf.bit_rate;
-		config.on_rx_frame = &on_rx_frame;
-		config.dbg = &__dbg;
-		rc = videortp_create(&config, &media->rtp);
-		if (rc == 0) {
-			rc = videortp_start(media->rtp);
-			if (rc != 0) {
-				Dbg("start video rtp failed!");
-				videortp_destroy(media->rtp);
-				media->rtp = NULL;
-				return rc;
-			}
-		} else {
-			Dbg("create video rtp failed!");
-			return rc;
-		}
-	}
-	{
-		int cap_mode, res_mode;
-		videocap_param param;
-		rc = calc_capture_mode(REC_COMMON_VIDEO_RAW_WIDTH, REC_COMMON_VIDEO_RAW_HEIGHT, &cap_mode);
-		if (rc != 0) {
-			Dbg("calc cap_mode failed!");
-			return rc;
-		}
-		rc = calc_capture_mode(REC_COMMON_VIDEO_WIDTH, REC_COMMON_VIDEO_HEIGHT, &res_mode);
-		if (rc != 0) {
-			Dbg("calc res_mode failed!");
-			return rc;
-		}
-		param.cap_mode = cap_mode;
-		param.res_mode = res_mode;
-		param.dev_id = media->owner->conf.dev_id;
-		param.frame_fmt = VIDEO_FORMAT_I420;
-		param.fps = REC_COMMON_VIDEO_RAW_FPS;
-		param.on_device_lost = NULL;
-		param.on_frame = NULL;
-		param.on_frame_raw = &phonemedia_cap_on_frame_raw;
-		param.pre_hwnd = media->local_hwnd;
-		param.pre_width = media->conf.local_video_view_cx;
-		param.pre_height = media->conf.local_video_view_cy;
-		param.user_data = media;
-		param.option = VIDEOCAP_OPT_EANBLE_RESIZE | VIDEOCAP_OPT_ENABLE_FLIP | VIDEOCAP_OPT_ENABLE_ASYNC_GRAB | VIDEOCAP_OPT_HOZFLIP;
-		//param.option = VIDEOCAP_OPT_EANBLE_RESIZE | VIDEOCAP_OPT_ENABLE_FLIP | VIDEOCAP_OPT_ENABLE_ASYNC_GRAB;
-		//param.option = VIDEOCAP_OPT_EANBLE_RESIZE | VIDEOCAP_OPT_ENABLE_ASYNC_GRAB;
-		rc = videocap_create(&media->cap, &param);
-		if (rc != 0) {
-			Dbg("create video capture object failed!");
-			return rc;
-		}
-		rc = videocap_start(media->cap);
-		if (rc != 0) {
-			Dbg("start video capture object failed!");
-			videocap_destroy(media->cap);
-			media->cap = NULL;
-			return rc;
-		}
-		rc = videoclock_create(REC_COMMON_VIDEO_FPS_NUM, REC_COMMON_VIDEO_FPS_DEN, 
-			REC_COMMON_VIDEO_WIDTH, REC_COMMON_VIDEO_HEIGHT, VIDEO_FORMAT_I420, &put_frame, media, &get_frame, media, &media->clock);
-		if (rc != 0) {
-			Dbg("video clock create failed!");
-			return rc;
-		}
-		rc = videoclock_start(media->clock);
-		if (rc != 0) {
-			Dbg("video clock start failed!");
-			return rc;
-		}
-	}
-	return 0;
-}
-
-static unsigned int __stdcall ui_proc(void *arg)
-{
-	phonemedia_t *media = (phonemedia_t*)arg;
-	WNDCLASSA wc = {0};
-	ATOM a = 0;
-	HWND hWnd = NULL;
-	MSG msg;
-	HINSTANCE hInst = ModuleBase::GetModuleBase()->GetInstance();
-
-	CoInitialize(0);
-
-	wc.cbClsExtra = 0;
-	wc.cbWndExtra = 0;
-	wc.hInstance = hInst;
-	wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
-	wc.hCursor = NULL;
-	wc.hIcon = NULL;
-	wc.lpfnWndProc = &WndProc;
-	wc.lpszClassName = WNDCLS_NAME;
-	wc.style = CS_HREDRAW | CS_OWNDC | CS_VREDRAW;
-
-	a = RegisterClassA(&wc);
-	if (a == 0)
-		return 0;
-
-	media->local_hwnd = CreateWindowExA(WS_EX_TOOLWINDOW | WS_EX_TOPMOST | WS_EX_NOACTIVATE, 
-		WNDCLS_NAME, NULL, WS_VISIBLE|WS_POPUP, 
-		media->conf.local_video_view_x, media->conf.local_video_view_y, media->conf.local_video_view_cx, media->conf.local_video_view_cy, 
-		NULL, NULL, hInst, NULL);
-	if (media->local_hwnd) {
-		SetWindowLongPtrA(media->local_hwnd, GWLP_USERDATA, (LONG_PTR)media);
-	}
-
-	media->remote_hwnd = CreateWindowExA(WS_EX_TOOLWINDOW | WS_EX_TOPMOST | WS_EX_NOACTIVATE, 
-		WNDCLS_NAME, NULL, WS_VISIBLE|WS_POPUP, 
-		media->conf.remote_video_view_x, media->conf.remote_video_view_y, media->conf.remote_video_view_cx, media->conf.remote_video_view_cy, 
-		NULL, NULL, hInst, NULL);
-	if (media->remote_hwnd) {
-		SetWindowLongPtrA(media->remote_hwnd, GWLP_USERDATA, (LONG_PTR)media);
-	}
-
-	if (media->local_hwnd && media->remote_hwnd) {
-		int rc;
-		
-		ShowCursor(FALSE);
-
-		SetEvent(media->ui_event);
-
-		rc = start_video(media);
-		if (rc != 0) {
-			Dbg("start video failed!");
-		} else {
-			Dbg("start video ok!");
-		}
-
-		while (GetMessageA(&msg, NULL, NULL, NULL)) {
-			TranslateMessage(&msg);
-			DispatchMessageA(&msg);
-		}
-		SetEvent(media->ui_event);
-	}
-	
-	if (a)
-		UnregisterClassA(WNDCLS_NAME, hInst);
-
-	CoUninitialize();
-
-	return 0;
-}
-
-static int phonemedia_start_ui(phonemedia_t *media)
-{
-	media->ui_event = CreateEventA(NULL, FALSE, FALSE, NULL);
-	if (!media->ui_event) {
-		Dbg("phonemedia_start create ui event failed!");
-		return Error_Resource;
-	}
-	media->ui_thread = (HANDLE)_beginthreadex(NULL, 0, &ui_proc, media, 0, NULL);
-	if (!media->ui_thread) {
-		Dbg("phonemedia_start create ui thread failed!");
-		CloseHandle(media->ui_event);
-		media->ui_event = NULL;
-		return Error_Resource;
-	}
-	Dbg("ui thread created ok!");
-	{
-		HANDLE hs[] = {media->ui_event, media->ui_thread};
-		DWORD dwRet = WaitForMultipleObjects(array_size(hs), hs, FALSE, INFINITE);
-		if (dwRet == WAIT_OBJECT_0) { // 
-			Dbg("wait for ui ready event ok!");
-		} else if (dwRet == WAIT_OBJECT_0 + 1) { // thread exit
-			Dbg("ui thread aborted unexpected!");
-			CloseHandle(media->ui_thread);
-			media->ui_thread = NULL;
-			CloseHandle(media->ui_event);
-			media->ui_event = NULL;
-			return Error_Resource;
-		}
-	}
-	return 0;
-}
-
-static void phonemedia_cap_on_frame(void *user_data, video_frame *frame)
-{
-	phonemedia_t *recorder = (phonemedia_t*)user_data;
-	assert(frame->format == VIDEO_FORMAT_I420);
-}
-
-static int phonemedia_create(video_session_t *session, const video_session_phonemedia_conf_t *conf, phonemedia_t **p_media)
-{
-	phonemedia_t *media = ZALLOC_T(phonemedia_t);
-	if (media) {
-		memcpy(&media->conf, conf, sizeof(video_session_phonemedia_conf_t));
-		media->owner = session;
-		*p_media = media;
-		return 0;
-	}
-	return Error_Resource;
-}
-static void phonemedia_destroy(video_session_t *session, void *media)
-{
-	free(media);
-}
-static int phonemedia_start(video_session_t *session, phonemedia_t *media)
-{
-	int rc;
-	rc = phonemedia_start_ui(media);
-	if (rc != 0) {
-		Dbg("phone media start ui failed!");
-		return rc;
-	}
-
-	return 0;
-}
-static int phonemedia_stop(video_session_t *session, void *object)
-{
-	phonemedia_t *media = (phonemedia_t*)object;
-	if (media->local_hwnd) {
-		PostMessageA(media->local_hwnd, WM_CLOSE, 0, 0);
-		WaitForSingleObject(media->ui_thread, INFINITE);
-		CloseHandle(media->ui_thread);
-		media->ui_thread = NULL;
-		CloseHandle(media->ui_event);
-		media->ui_event = NULL;
-		return 0;
-	}
-	return Error_NotInit;
-}
-
-int video_session_create(const video_session_conf_t *conf, video_session_t **p_session)
-{
-	video_session_t *session = ZALLOC_T(video_session_t);
-	if (session) {
-		memcpy(&session->conf, conf, sizeof(video_session_conf_t));
-		session->video_shm_q = new Clibvideoqueue(conf->shm_videoq_name);
-		Dbg("strShareQueueName:%s", (LPCSTR)conf->shm_videoq_name);
-		*p_session = session;
-		return 0;
-	}
-	return Error_Resource;
-}
-
-int video_session_start_recording(video_session_t *session)
-{
-	if (!session->object) {
-		int rc = recorder_create(session, NULL, (recorder_t**)&session->object);
-		if (rc == 0) {
-			rc = recorder_start(session, (recorder_t*)session->object);
-			if (rc != 0) {
-				recorder_destroy(session, (recorder_t*)session->object);
-				session->object = NULL;
-			} else {
-				session->destroy = &recorder_destroy;
-				session->stop = &recorder_stop;
-			}
-		}
-		return rc;
-	} else {
-		return Error_Duplication;
-	}
-}
-
-int video_session_start_phonemedia(video_session_t *session, const video_session_phonemedia_conf_t *conf)
-{
-	if (!session->object) {
-		int rc = phonemedia_create(session, conf, (phonemedia_t**)&session->object);
-		if (rc == 0) {
-			rc = phonemedia_start(session, (phonemedia_t*)session->object);
-			if (rc != 0) {
-				phonemedia_destroy(session, (phonemedia_t*)session->object);
-				session->object = NULL;
-			} else {
-				session->destroy = &phonemedia_destroy;
-				session->stop = &phonemedia_stop;
-			}
-		}
-		return rc;
-	} else {
-		return Error_Duplication;
-	}
-}
-
-int video_session_stop(video_session_t *session)
-{
-	if (session->object) {
-		int rc = session->stop(session, session->object);
-		if (rc != 0) {
-			Dbg("stop session failed!");
-		} else {
-			session->destroy(session, session->object);
-			session->object = NULL;
-		}
-		return rc;
-	} else {
-		return Error_NotInit;
-	}
-	
-}
-
-void video_session_destroy(video_session_t *session)
-{
-	delete session->video_shm_q;
-	free(session);
-}
-
-int video_get_dev_count(int *cnt)
-{
-	int n = videocap_get_device_count();
-	if (n >= 0) {
-		*cnt = n;
-		return Error_Succeed;
-	} else {
-		Dbg("videocap get device count failed!");
-		return Error_Unexpect;
-	}
-}
-
-CSimpleStringA video_get_dev_name(int idx)
-{
-	WCHAR tmp[256];
-	char t[256];
-	videocap_get_device_name(idx, tmp, ARRAYSIZE(tmp));
-	WideCharToMultiByte(CP_ACP, 0, tmp, -1, t, sizeof(t), 0, NULL);
-	return CSimpleStringA(t);
-}
-

+ 0 - 55
Module/mod_mediacontroller/video_session.h

@@ -1,55 +0,0 @@
-#ifndef MEDIACONTROLLER_VIDEO_H
-#define MEDIACONTROLLER_VIDEO_H
-
-#pragma once
-
-typedef struct video_session_conf_t
-{
-	int dev_id;
-	char shm_videoq_name[32];
-}video_session_conf_t;
-
-typedef struct video_session_phonemedia_conf_t
-{
-	unsigned long local_rtp_ip;
-	int local_rtp_port;
-	unsigned long remote_rtp_ip;
-	int remote_rtp_port;
-
-	// remote video params
-	int remote_video_fps_den;
-	int remote_video_fps_num;
-	int remote_video_width;
-	int remote_video_height;
-	int remote_video_view_x;
-	int remote_video_view_y;
-	int remote_video_view_cx;
-	int remote_video_view_cy;
-
-	// local video params
-	int local_video_view_x;
-	int local_video_view_y;
-	int local_video_view_cx;
-	int local_video_view_cy;
-
-	int mtu;
-	int video_quant; // 0-10
-	int bit_rate; // 256*1024
-}video_session_phonemedia_conf_t;
-
-typedef struct video_session_t video_session_t;
-
-int video_session_create(const video_session_conf_t *conf, video_session_t **p_session);
-int video_session_start_recording(video_session_t *session);
-int video_session_start_phonemedia(video_session_t *session, const video_session_phonemedia_conf_t *conf);
-int video_session_stop(video_session_t *session);
-void video_session_destroy(video_session_t *session);
-
-extern "C" {
-	int video_lib_init();
-	void video_lib_deinit();
-}
-int video_get_dev_count(int *cnt);
-CSimpleStringA video_get_dev_name(int idx);
-
-#endif

+ 100 - 0
Other/include/rvc_media_common.h

@@ -0,0 +1,100 @@
+#ifndef REC_COMMON_H
+#define REC_COMMON_H
+
+#pragma once
+
+// video codec: h264, audio codec: G729a 
+
+// video size of single screen: 320x240(remote), 320x240(local)
+// video size of dual screen:	640x480(remote), 320x240(local) 双屏双摄像头通知周小斌,改回320x240
+
+#define REC_COMMON_AUDIO_FRAME_PTIME	100
+#define REC_COMMON_AUDIO_FRAME_PSIZE	165
+
+#define REC_COMMON_AUDIO_CLOCK	8000
+#define REC_COMMON_VIDEO_CLOCK	90000
+
+#define REC_COMMON_VIDEO_FPS_DEN	1
+#define REC_COMMON_VIDEO_FPS_NUM	10			//8
+#define REC_COMMON_VIDEO_FPS_MOBILE 8           //5   //移动版视频5帧/s
+#define REC_COMMON_VIDEO_FPS_MOBILE_AGENT 8 	//2  //移动版坐席视频2帧/s
+#define REC_COMMON_VIDEO_FPS		10.0f		//8.0f
+#define REC_COMMON_VIDEO_RAW_FPS	15.0f		//8.0f
+#define REC_COMMON_VIDEO_PADRAW_FPS	10.0f	
+
+#define REC_COMMON_VIDEO_RAW_FPS_DEN	1
+#define REC_COMMON_VIDEO_RAW_FPS_NUM	8
+#define REC_COMMON_VIDEO_SNAPSHOT_FPS	1.0f
+#define REC_COMMON_VIDEO_CAPTURE_FRAME_INTERVAL	8
+#define REC_COMMON_VIDEO_ENCODE_FRAME_INTERVAL	1
+
+#define REC_COMMON_AUDIO_PT		18 // g729
+#define REC_COMMON_VIDEO_PT     101 // H264+
+#define REC_COMMON_VIDEO_H264_PT   97  // H264
+
+#define REC_COMMON_JITTER_MIN_CACHE_MSEC	1000
+#define REC_COMMON_JITTER_MAX_CACHE_MSEC	2000
+
+#define REC_COMMON_VIDEO_RTP_ENV_WIDTH	320	
+#define REC_COMMON_VIDEO_RTP_ENV_HEIGHT	180
+#define REC_COMMON_VIDEO_RTP_OPT_WIDTH	180
+#define REC_COMMON_VIDEO_RTP_OPT_HEIGHT	320
+
+#define REC_COMMON_VIDEO_RTP_EWS_WIDTH	320	
+#define REC_COMMON_VIDEO_RTP_EWS_HEIGHT	180
+
+#define REC_COMMON_VIDEO_PREVIEW_WIDTH	320
+#define REC_COMMON_VIDEO_PREVIEW_HEIGHT	240
+
+#define REC_COMMON_VIDEO_RTP_WIDTH			320
+#define REC_COMMON_VIDEO_RTP_HEIGHT			320
+#define REC_COMMON_VIDEO_RTP_PADDING		70
+
+#define REC_COMMON_VIDEO_SNAPSHOT_WIDTH		640
+#define REC_COMMON_VIDEO_SNAPSHOT_HEIGHT	360
+#define REC_COMMON_VIDEO_SNAPSHOT_PREVIEW_WIDTH		480
+#define REC_COMMON_VIDEO_SNAPSHOT_PREVIEW_HEIGHT	360
+
+#define REC_COMMON_VIDEO_AGENT_RAW_WIDTH	1280
+#define REC_COMMON_VIDEO_AGENT_RAW_HEIGHT	720
+
+#define REC_COMMON_VIDEO_AGENT_PREVIEW_WIDTH	320
+#define REC_COMMON_VIDEO_AGENT_PREVIEW_HEIGHT	320
+
+#define REC_COMMON_VIDEO_SSM_AGENT_WIDTH	320	// single screen mode(ssm)
+#define REC_COMMON_VIDEO_SSM_AGENT_HEIGHT	240
+#define REC_COMMON_VIDEO_DSM_AGENT_WIDTH	640	// dual screen mode(dsm)
+#define REC_COMMON_VIDEO_DSM_AGENT_HEIGHT	480
+
+#define REC_COMMON_AUDIO_PORT_START			40000
+#define REC_COMMON_AUDIO_PORT_STOP			50000
+#define REC_COMMON_VIDEO_PORT				30000
+
+#define CAMERA_TYPE_ERROR -1
+#define CAMERA_TYPE_ENV	0
+#define CAMERA_TYPE_OPT	1
+#define CAMERA_TYPE_AUTO 2
+#define CAMERA_TYPE_EWS 3
+
+#define REC_COMMON_VIDEO_ENV_SHM_SNAPSHOT_QUEUE		"rvc.shm.snapshot.video.env.q"	    // 640x360@1fps RGB24
+#define REC_COMMON_VIDEO_ENV_SHM_RTP_QUEUE			"rvc.shm.rtp.video.env.q"		    // 320x180@8fps I420
+#define REC_COMMON_VIDEO_ENV_SHM_PREVIEW_QUEUE		"rvc.shm.preview.video.env.q"	    //	320x240@8fps RGB24
+
+#define REC_COMMON_VIDEO_OPT_SHM_SNAPSHOT_QUEUE		"rvc.shm.snapshot.video.opt.q"	    // 360x640@1fps RGB24
+#define REC_COMMON_VIDEO_OPT_SHM_RTP_QUEUE			"rvc.shm.rtp.video.opt.q"		    // 180x320@8fps I420
+#define REC_COMMON_VIDEO_OPT_SHM_PREVIEW_QUEUE		"rvc.shm.preview.video.opt.q"	    //	240x320@8fps RGB24
+
+#define REC_COMMON_VIDEO_EWS_SHM_SNAPSHOT_QUEUE		"rvc.shm.snapshot.ews_video.q"	    // 640x360@1fps RGB24
+#define REC_COMMON_VIDEO_EWS_SHM_RTP_QUEUE			"rvc.shm.rtp.ews_video.q"		    // 320x180@8fps I420
+#define REC_COMMON_VIDEO_SALES_EWS_SHM_RTP_QUEUE	"rvc.shm.rtp.ews_sales_video.q"		// 320x180@8fps I420
+#define REC_COMMON_VIDEO_EWS_SHM_PREVIEW_QUEUE		"rvc.shm.preview.ews_video.q"	    //	320x240@8fps RGB24
+
+#define REC_COMMON_VIDEO_REMOTE_SHM_RTP_QUEUE		"rvc.shm.rtp.video.remote.q"	    // 320x240@8fps //远端视频
+
+#define REC_COMMON_AUDIO_SHM_QUEUE		            "rvc.shm.audio.q"
+#define REC_COMMON_AUDIO_SALESOL_SHM_QUEUE		    "rvc.shm.salesol_audio.q"
+#define REC_COMMON_AUDIO_SALES_SHM_QUEUE		    "rvc.shm.sales_audio.q"
+#define REC_COMMON_AUDIO_EWS_SHM_QUEUE		        "rvc.shm.ews_audio.q"
+#define REC_COMMON_REMOTEAUDIO_SHM_QUEUE		    "rvc.shm.agentaudio.q"
+
+#endif // REC_COMMON_H

+ 212 - 0
Other/libaudioframework/CMakeLists.txt

@@ -0,0 +1,212 @@
+set(MODULE_NAME "libaudioframework")
+set(MODULE_PREFIX "LIB_AUDIOFRAMEWORK_FUNC")
+
+if(RVC_DEBUG_MODE)
+    set(SPBASE_LIB spbased)
+else()
+    set(SPBASE_LIB spbase)
+endif(RVC_DEBUG_MODE)
+
+set(${MODULE_PREFIX}_SRCS
+    audioaec.h
+    audiobridge.h 
+    audiocache.h 
+    audiocodec.h 
+    audiocommon.h 
+    audioconf.h 
+    audiocontext.h 
+    audiocustom.h 
+    audiodbmeter.h 
+    audiodriver.h 
+    audiodrivergroup.h 
+    audiodsp.h 
+    audiodtmf.h 
+    audiodtmfbridge.h 
+    audioengine.h 
+    audiofax.h 
+    audiofile.h 
+    audioframe.h 
+    audioframework.h 
+    audiolog.h 
+    audiomicspk.h 
+    audiomicspk2.h 
+    audiomicspk3.h 
+    audiomixer.h 
+    audiorecply.h 
+    audioresample.h 
+    audioresize.h 
+    audiortp.h 
+    audiosilencedet.h 
+    audiostream.h 
+    audiotone.h 
+    audiovoxfile.h 
+    audiowavfile.h 
+    codec/g729acodec.h 
+    precompile.h 
+    codec/adpcmcodec.h 
+    #codec/bvcodec.h 
+    codec/codecmgr.h 
+    codec/g711codec.h 
+    codec/gsmcodec.h 
+    other/circbuf.h 
+    other/delaybuf.h 
+    other/jbuf.h 
+    other/plc.h 
+    other/silencedet.h 
+    other/wsola.h 
+    audioaec.c 
+    audiobridge.c 
+    audiocache.c 
+    audiocodec.c 
+    audiocommon.c 
+    audioconf.c 
+    audiocontext.c 
+    audiocustom.c 
+    audiodbmeter.c 
+    audiodriver.c 
+    audiodrivergroup.c 
+    audiodsp.c 
+    audiodtmf.c 
+    audiodtmfbridge.c 
+    audioengine.c 
+    audiofax.c 
+    audiofile.c 
+    audiolog.c 
+    audiomicspk.c 
+    audiomicspk2.c 
+    audiomicspk3.c 
+    audiomixer.c 
+    audiorecply.c
+    audioresample.c 
+    audioresize.c 
+    audiortp.c 
+    audiosilencedet.c 
+    audiostream.c 
+    audiotone.c 
+    audiovoxfile.c 
+    audiowavfile.c 
+    codec/g729acodec.c 
+    codec/adpcmcodec.c 
+    #codec/bvcodec.c
+    codec/codecmgr.c 
+    codec/g711codec.c 
+    codec/gsmcodec.c 
+    other/delaybuf.c
+    other/jbuf.c
+    other/plc.c
+    other/silencedet.c
+    other/wsola.c
+	precompile.c
+)
+
+add_library(${MODULE_NAME} STATIC ${${MODULE_PREFIX}_SRCS})
+
+add_precompiled_header(${MODULE_NAME} precompile.h SOURCE_C precompile.c FORCEINCLUDE)
+
+if(WIN32)
+conan_cmake_run(REQUIRES ffmpeg/4.1@LR04.02_ThirdParty/testing
+BASIC_SETUP CMAKE_TARGETS
+BUILD missing)
+else(WIN32)
+conan_cmake_run(REQUIRES ffmpeg/4.1@LR04.02_ThirdParty/testing
+BASIC_SETUP CMAKE_TARGETS
+BUILD missing)
+endif(WIN32)
+
+
+if(WIN32)
+conan_cmake_run(REQUIRES apache-apr/1.6.3@LR04.02_ThirdParty/testing
+BASIC_SETUP CMAKE_TARGETS
+BUILD missing)
+else(WIN32)
+conan_cmake_run(REQUIRES apache-apr/1.6.3@LR04.02_ThirdParty/testing
+BASIC_SETUP CMAKE_TARGETS
+BUILD missing)
+endif(WIN32)
+
+if(WIN32)
+conan_cmake_run(REQUIRES portaudio/v190600.20161030@LR04.02_ThirdParty/testing
+BASIC_SETUP CMAKE_TARGETS
+BUILD missing)
+else(WIN32)
+conan_cmake_run(REQUIRES portaudio/v190600.20161030@LR04.02_ThirdParty/testing
+BASIC_SETUP CMAKE_TARGETS
+BUILD missing)
+endif(WIN32)
+
+if(WIN32)
+conan_cmake_run(REQUIRES spandsp/0.0.6@LR04.02_ThirdParty/testing
+BASIC_SETUP CMAKE_TARGETS
+BUILD missing)
+else(WIN32)
+conan_cmake_run(REQUIRES spandsp/0.0.6@LR04.02_ThirdParty/testing
+BASIC_SETUP CMAKE_TARGETS
+BUILD missing)
+endif(WIN32)
+
+
+if(WIN32)
+conan_cmake_run(REQUIRES SpeexDSP/1.2rc3@LR04.02_ThirdParty/testing
+BASIC_SETUP CMAKE_TARGETS
+BUILD missing)
+else(WIN32)
+conan_cmake_run(REQUIRES SpeexDSP/1.2rc3@LR04.02_ThirdParty/testing
+BASIC_SETUP CMAKE_TARGETS
+BUILD missing)
+endif(WIN32)
+
+
+if(WIN32)
+conan_cmake_run(REQUIRES lib8k/1.0@LR04.02_ThirdParty/testing
+BASIC_SETUP CMAKE_TARGETS
+BUILD missing)
+else(WIN32)
+conan_cmake_run(REQUIRES lib8k/1.0@LR04.02_ThirdParty/testing
+BASIC_SETUP CMAKE_TARGETS
+BUILD missing)
+endif(WIN32)
+
+
+if(WIN32)
+conan_cmake_run(REQUIRES libtiff/4.0.9@LR04.02_ThirdParty/testing
+BASIC_SETUP CMAKE_TARGETS
+BUILD missing)
+else(WIN32)
+conan_cmake_run(REQUIRES libtiff/4.0.9@LR04.02_ThirdParty/testing
+BASIC_SETUP CMAKE_TARGETS
+BUILD missing)
+endif(WIN32)
+
+
+
+target_include_directories(${MODULE_NAME} PRIVATE
+	${RVC_COMMON_INCLUDE_DIR}
+	${CONAN_INCLUDE_DIRS_FFMPEG}
+	${CONAN_INCLUDE_DIRS_APACHE-APR}
+	${CONAN_INCLUDE_DIRS_PORTAUDIO}
+	${CONAN_INCLUDE_DIRS_SPANDSP}/src
+	${CONAN_RVCFRAMEWORK_ROOT}/include
+	${CONAN_INCLUDE_DIRS_SPEEXDSP}
+	${RVC_TOOLKIT_INCLUDE_DIR}
+	${CONAN_INCLUDE_DIRS_LIB8K}
+	${CONAN_INCLUDE_DIRS_LIBTIFF}
+	)
+
+target_link_directories(${MODULE_NAME} PRIVATE
+	${CONAN_LIB_DIRS_FFMPEG}
+	${CONAN_LIB_DIRS_RVCFRAMEWORK}
+	${CONAN_LIB_DIRS_APACHE-APR}
+	${CONAN_LIB_DIRS_PORTAUDIO}
+	${CONAN_LIB_DIRS_SPANDSP}
+	${CONAN_LIB_DIRS_SPEEXDSP}
+	${CONAN_LIB_DIRS_LIB8K}
+	${CONAN_LIB_DIRS_LIBTIFF}
+	)
+
+
+target_link_libraries(${MODULE_NAME} PRIVATE ${${MODULE_PREFIX}_LIBS} 
+	${CONAN_LIBS_FFMPEG}
+	${SPBASE_LIB}
+	)  
+
+	

+ 4 - 4
Other/libaudioframework/audiocodec.c

@@ -1,10 +1,10 @@
 #include "precompile.h"
 #include "audiocodec.h"
 #include "audiocontext.h"
-#include "other\wsola.h"
-#include "codec\codecmgr.h"
-#include "codec\g711codec.h"
-#include "codec\g729acodec.h"
+#include "other/wsola.h"
+#include "codec/codecmgr.h"
+#include "codec/g711codec.h"
+#include "codec/g729acodec.h"
 
 #include <assert.h>
 

+ 7 - 7
Other/libaudioframework/audiocommon.c

@@ -1,15 +1,15 @@
 #include "precompile.h"
 #include "audiocommon.h"
 #include "audiolog.h"
-#include "codec\codecmgr.h"
-#include "codec\g711codec.h"
-#include "codec\bvcodec.h"
-#include "codec\gsmcodec.h"
-#include "codec\adpcmcodec.h"
-#include "codec\g729acodec.h"
+#include "codec/codecmgr.h"
+#include "codec/g711codec.h"
+//#include "codec\bvcodec.h"
+#include "codec/gsmcodec.h"
+#include "codec/adpcmcodec.h"
+#include "codec/g729acodec.h"
 
 #include <portaudio.h>
-#include <pa_debugprint.h>
+#include <common/pa_debugprint.h>
 
 static int g_initialized = 0;
 

+ 1 - 1
Other/libaudioframework/audiomicspk.c

@@ -2,7 +2,7 @@
 #include "audiomicspk.h"
 #include "audiocontext.h"
 #include "audiolog.h"
-#include ".\other\delaybuf.h"
+#include "./other/delaybuf.h"
 
 #include <portaudio.h>
 #include <assert.h>

+ 2 - 2
Other/libaudioframework/audiomicspk2.c

@@ -6,7 +6,7 @@
 #include <assert.h>
 
 #include "audiolog.h"
-#include ".\other\delaybuf.h"
+#include "./other/delaybuf.h"
 
 #include <dmo.h>
 #include <Mmsystem.h>
@@ -25,7 +25,7 @@
 
 #include <portaudio.h>
 
-#include <speex\speex_resampler.h>
+#include <speex/speex_resampler.h>
 
 #include <math.h>
 #define CLOCK_PERIOD	20

+ 1 - 1
Other/libaudioframework/audiomicspk3.c

@@ -6,7 +6,7 @@
 #include <assert.h>
 
 #include "audiolog.h"
-#include ".\other\delaybuf.h"
+#include "./other/delaybuf.h"
 
 #include <dmo.h>
 #include <Mmsystem.h>

+ 1 - 1
Other/libaudioframework/audioresample.c

@@ -3,7 +3,7 @@
 #include "audiolog.h"
 #include "audiocontext.h"
 
-#include <speex\speex_resampler.h>
+#include <speex/speex_resampler.h>
 
 static apr_status_t read_frame(void *self, audioframe_t *frame)
 {

+ 1 - 1
Other/libaudioframework/audiortp.c

@@ -4,7 +4,7 @@
 #include "audiostream.h"
 #include "audiocontext.h"
 #include "audiolog.h"
-#include "other\jbuf.h"
+#include "other/jbuf.h"
 
 #include <assert.h>
 

+ 1 - 1
Other/libaudioframework/audiortp.h

@@ -9,7 +9,7 @@ extern "C" {
 
 #include "audiostream.h"
 #include "rtpsession.h"
-#include "other\jbuf.h"
+#include "other/jbuf.h"
 
 #define AUDIO_RTP_FLAG_RECV_PTIME		0x01
 #define AUDIO_RTP_FLAG_SEND_PTIME		0x02

+ 0 - 225
Other/libaudioframework/codec/bvcodec.c

@@ -1,225 +0,0 @@
-#include "precompile.h"
-
-#pragma warning(disable: 4005)
-
-#include "bvcodec.h"
-#include "broadvoice.h"
-
-#define NB_CLOCK	8000
-#define WB_CLOCK	16000
-
-static codec_factory_t g_bv16_factory;
-
-typedef struct bv16_codec_t
-{
-	codec_t base;
-	bv16_encode_state_t *encoder;
-	bv16_decode_state_t *decoder;
-} bv16_codec_t;
-
-static codec_t* bv16_codec_create(apr_pool_t *pool, int clock, int ptime)
-{
-	bv16_codec_t *codec;
-
-	if (clock != NB_CLOCK)
-		return NULL;
-	codec = apr_palloc(pool, sizeof(bv16_codec_t));
-	codec->base.pool = pool;
-	codec->base.ptime = ptime;
-	codec->base.clock = clock;
-	codec->base.factory = &g_bv16_factory;
-	codec->base.kvp_table = apr_table_make(pool, 3);
-	codec->encoder = bv16_encode_init(NULL);
-	codec->decoder = bv16_decode_init(NULL);
-
-	return &codec->base;
-}
-static void bv16_codec_destroy(codec_t *c)
-{
-	bv16_codec_t *codec = (bv16_codec_t *)c;
-	bv16_encode_free(codec->encoder);
-	bv16_decode_free(codec->decoder);
-}
-static apr_status_t bv16_codec_set_param(codec_t *codec, 
-												 const char *key, 
-												 const char *value)
-{
-	return APR_ENOTIMPL;
-}
-static apr_status_t bv16_codec_get_param(codec_t *codec, 
-												 const char *key, 
-												 char *value)
-{
-	return APR_ENOTIMPL;
-}
-static apr_status_t bv16_codec_init(codec_t *codec)
-{
-	return APR_SUCCESS;
-}
-static apr_status_t bv16_codec_term(codec_t *codec)
-{
-	return APR_SUCCESS;
-}
-static apr_status_t bv16_codec_encode(codec_t *c, 
-											  const void *inbuf, 
-											  int insize, 
-											  void *outbuf, 
-											  int *outsize)
-{
-	bv16_codec_t *codec = (bv16_codec_t *)c;
-	if (insize) {
-		*outsize = bv16_encode(codec->encoder, outbuf, inbuf, insize/2);
-	} else {
-		*outsize = 0;
-	}
-	return APR_SUCCESS;
-}
-static apr_status_t bv16_codec_decode(codec_t *c, 
-											  const void *inbuf, 
-											  int insize, 
-											  void *outbuf, 
-											  int *outsize)
-{
-	bv16_codec_t *codec = (bv16_codec_t *)c;
-	if (insize) {
-		*outsize = 2 * bv16_decode(codec->decoder, outbuf, inbuf, insize);
-	} else {
-		*outsize = 0;
-	}
-	return APR_SUCCESS;
-}
-
-static codec_factory_t g_bv32_factory;
-
-typedef struct bv32_codec_t
-{
-	codec_t base;
-	bv32_encode_state_t *encoder;
-	bv32_decode_state_t *decoder;
-} bv32_codec_t;
-
-static codec_t* bv32_codec_create(apr_pool_t *pool, int clock, int ptime)
-{
-	bv32_codec_t *codec;
-	apr_status_t status;
-	apr_pool_t *subpool;
-
-	if (clock != WB_CLOCK)
-		return NULL;
-	status = apr_pool_create(&subpool, pool);
-	if (status != APR_SUCCESS)
-		return NULL;
-	codec = apr_palloc(pool, sizeof(bv32_codec_t));
-	codec->base.pool = subpool;
-	codec->base.ptime = ptime;
-	codec->base.clock = clock;
-	codec->base.factory = &g_bv16_factory;
-	codec->base.kvp_table = apr_table_make(subpool, 3);
-	codec->encoder = bv32_encode_init(NULL);
-	codec->decoder = bv32_decode_init(NULL);
-
-	return &codec->base;
-}
-static void bv32_codec_destroy(codec_t *c)
-{
-	bv32_codec_t *codec = (bv32_codec_t *)c;
-	bv32_encode_free(codec->encoder);
-	bv32_decode_free(codec->decoder);
-	apr_pool_destroy(codec->base.pool);
-}
-static apr_status_t bv32_codec_set_param(codec_t *codec, 
-												 const char *key, 
-												 const char *value)
-{
-	return APR_ENOTIMPL;
-}
-static apr_status_t bv32_codec_get_param(codec_t *codec, 
-												 const char *key, 
-												 char *value)
-{
-	return APR_ENOTIMPL;
-}
-static apr_status_t bv32_codec_init(codec_t *codec)
-{
-	return APR_SUCCESS;
-}
-static apr_status_t bv32_codec_term(codec_t *codec)
-{
-	return APR_SUCCESS;
-}
-static apr_status_t bv32_codec_encode(codec_t *c, 
-											  const void *inbuf, 
-											  int insize, 
-											  void *outbuf, 
-											  int *outsize)
-{
-	bv32_codec_t *codec = (bv32_codec_t *)c;
-	if (insize) {
-		*outsize = bv32_encode(codec->encoder, outbuf, inbuf, insize/2);
-	} else {
-		*outsize = 0;
-	}	
-	return APR_SUCCESS;
-}
-static apr_status_t bv32_codec_decode(codec_t *c, 
-											  const void *inbuf, 
-											  int insize, 
-											  void *outbuf, 
-											  int *outsize)
-{
-	bv32_codec_t *codec = (bv32_codec_t *)c;
-	if (insize) {
-		*outsize = 2 * bv32_decode(codec->decoder, outbuf, inbuf, insize);
-	} else {
-		*outsize = 0;
-	}
-	return APR_SUCCESS;
-}
-
-apr_status_t bv_codec_factory_init()
-{
-	apr_status_t status;
-
-	g_bv16_factory.name = "BV16";
-	g_bv16_factory.create = &bv16_codec_create;
-	g_bv16_factory.destroy = &bv16_codec_destroy;
-	g_bv16_factory.set_param = &bv16_codec_set_param;
-	g_bv16_factory.get_param = &bv16_codec_get_param;
-	g_bv16_factory.init = &bv16_codec_init;
-	g_bv16_factory.term = &bv16_codec_term;
-	g_bv16_factory.encode = &bv16_codec_encode;
-	g_bv16_factory.decode = &bv16_codec_decode;
-	status = codec_factory_register(&g_bv16_factory);
-	if (status != APR_SUCCESS)
-		return status;
-
-	g_bv32_factory.name = "BV32";
-	g_bv32_factory.create = &bv32_codec_create;
-	g_bv32_factory.destroy = &bv32_codec_destroy;
-	g_bv32_factory.set_param = &bv32_codec_set_param;
-	g_bv32_factory.get_param = &bv32_codec_get_param;
-	g_bv32_factory.init = &bv32_codec_init;
-	g_bv32_factory.term = &bv32_codec_term;
-	g_bv32_factory.encode = &bv32_codec_encode;
-	g_bv32_factory.decode = &bv32_codec_decode;
-	status = codec_factory_register(&g_bv32_factory);
-	if (status != APR_SUCCESS)
-		return status;
-
-	return status;
-}
-
-apr_status_t bv_codec_factory_term()
-{
-	apr_status_t status;
-
-	status = codec_factory_unregister(&g_bv16_factory);
-	if (status != APR_SUCCESS)
-		return status;
-
-	status = codec_factory_unregister(&g_bv32_factory);
-	if (status != APR_SUCCESS)
-		return status;
-
-	return status;
-}

+ 0 - 19
Other/libaudioframework/codec/bvcodec.h

@@ -1,19 +0,0 @@
-#ifndef __BVCODEC_H__
-#define __BVCODEC_H__
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "codecmgr.h"
-
-apr_status_t bv_codec_factory_init();
-apr_status_t bv_codec_factory_term();
-
-#ifdef __cplusplus
-} // extern "C" {
-#endif
-
-#endif //__BVCODEC_H__

+ 0 - 212
Other/libaudioframework/libaudioframework.vcxproj

@@ -1,212 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
-  <PropertyGroup Label="Globals">
-    <ProjectGuid>{27A0E22D-A039-46C8-A3E4-B0F290D8FE5E}</ProjectGuid>
-    <RootNamespace>libaudioframework</RootNamespace>
-    <Keyword>Win32Proj</Keyword>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>StaticLibrary</ConfigurationType>
-    <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>Windows7.1SDK</PlatformToolset>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>StaticLibrary</ConfigurationType>
-    <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>Windows7.1SDK</PlatformToolset>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <Import Project="..\libmake.setting" />
-  <PropertyGroup>
-    <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
-    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
-    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
-    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
-    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
-    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
-    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <ClCompile>
-      <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <MinimalRebuild>true</MinimalRebuild>
-      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <PrecompiledHeaderFile>precompile.h</PrecompiledHeaderFile>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
-      <AdditionalIncludeDirectories>$(ThirdPartyHeadRoot)\apr\include;$(ThirdPartyHeadRoot)\spandsp-0.0.6\src;$(ThirdPartyHeadRoot)\speex-1.2rc1\include;$(ThirdPartyHeadRoot)\liba8k;$(ThirdPartyHeadRoot)\portaudio\src\common;$(ThirdPartyHeadRoot)\portaudio\include;$(ThirdPartyHeadRoot)\tiff-3.8.2\libtiff;$(FrameworkHeadRoot)\libtoolkit</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Lib />
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <Optimization>MaxSpeed</Optimization>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <AdditionalIncludeDirectories>$(ThirdPartyHeadRoot)\apr\include;$(ThirdPartyHeadRoot)\spandsp-0.0.6\src;$(ThirdPartyHeadRoot)\speex-1.2rc1\include;$(ThirdPartyHeadRoot)\liba8k;$(ThirdPartyHeadRoot)\portaudio\src\common;$(ThirdPartyHeadRoot)\portaudio\include;$(ThirdPartyHeadRoot)\tiff-3.8.2\libtiff;$(FrameworkHeadRoot)\libtoolkit</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;BROADVOICE_STATIC_LIB;APR_DECLARE_STATIC;APU_DECLARE_STATIC;API_DECLARE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <PrecompiledHeaderFile>precompile.h</PrecompiledHeaderFile>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-    </ClCompile>
-  </ItemDefinitionGroup>
-  <ItemGroup>
-    <ClCompile Include="audioaec.c" />
-    <ClCompile Include="audiobridge.c" />
-    <ClCompile Include="audiocache.c" />
-    <ClCompile Include="audiocodec.c" />
-    <ClCompile Include="audiocommon.c" />
-    <ClCompile Include="audioconf.c" />
-    <ClCompile Include="audiocontext.c" />
-    <ClCompile Include="audiocustom.c" />
-    <ClCompile Include="audiodbmeter.c" />
-    <ClCompile Include="audiodriver.c" />
-    <ClCompile Include="audiodrivergroup.c" />
-    <ClCompile Include="audiodsp.c" />
-    <ClCompile Include="audiodtmf.c" />
-    <ClCompile Include="audiodtmfbridge.c" />
-    <ClCompile Include="audioengine.c" />
-    <ClCompile Include="audiofax.c" />
-    <ClCompile Include="audiofile.c" />
-    <ClCompile Include="audiolog.c" />
-    <ClCompile Include="audiomicspk.c" />
-    <ClCompile Include="audiomicspk2.c" />
-    <ClCompile Include="audiomicspk3.c" />
-    <ClCompile Include="audiomixer.c" />
-    <ClCompile Include="audiorecply.c">
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
-    </ClCompile>
-    <ClCompile Include="audioresample.c" />
-    <ClCompile Include="audioresize.c" />
-    <ClCompile Include="audiortp.c" />
-    <ClCompile Include="audiosilencedet.c" />
-    <ClCompile Include="audiostream.c" />
-    <ClCompile Include="audiotone.c" />
-    <ClCompile Include="audiovoxfile.c" />
-    <ClCompile Include="audiowavfile.c" />
-    <ClCompile Include="codec\g729acodec.c" />
-    <ClCompile Include="precompile.c">
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
-    </ClCompile>
-    <ClCompile Include="codec\adpcmcodec.c" />
-    <ClCompile Include="codec\bvcodec.c">
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
-    </ClCompile>
-    <ClCompile Include="codec\codecmgr.c" />
-    <ClCompile Include="codec\g711codec.c" />
-    <ClCompile Include="codec\gsmcodec.c" />
-    <ClCompile Include="other\delaybuf.c">
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-      </PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-      </PrecompiledHeader>
-    </ClCompile>
-    <ClCompile Include="other\jbuf.c">
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-      </PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-      </PrecompiledHeader>
-    </ClCompile>
-    <ClCompile Include="other\plc.c">
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-      </PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-      </PrecompiledHeader>
-    </ClCompile>
-    <ClCompile Include="other\silencedet.c">
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-      </PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-      </PrecompiledHeader>
-    </ClCompile>
-    <ClCompile Include="other\wsola.c">
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-      </PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-      </PrecompiledHeader>
-    </ClCompile>
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="audioaec.h" />
-    <ClInclude Include="audiobridge.h" />
-    <ClInclude Include="audiocache.h" />
-    <ClInclude Include="audiocodec.h" />
-    <ClInclude Include="audiocommon.h" />
-    <ClInclude Include="audioconf.h" />
-    <ClInclude Include="audiocontext.h" />
-    <ClInclude Include="audiocustom.h" />
-    <ClInclude Include="audiodbmeter.h" />
-    <ClInclude Include="audiodriver.h" />
-    <ClInclude Include="audiodrivergroup.h" />
-    <ClInclude Include="audiodsp.h" />
-    <ClInclude Include="audiodtmf.h" />
-    <ClInclude Include="audiodtmfbridge.h" />
-    <ClInclude Include="audioengine.h" />
-    <ClInclude Include="audiofax.h" />
-    <ClInclude Include="audiofile.h" />
-    <ClInclude Include="audioframe.h" />
-    <ClInclude Include="audioframework.h" />
-    <ClInclude Include="audiolog.h" />
-    <ClInclude Include="audiomicspk.h" />
-    <ClInclude Include="audiomicspk2.h" />
-    <ClInclude Include="audiomicspk3.h" />
-    <ClInclude Include="audiomixer.h" />
-    <ClInclude Include="audiorecply.h" />
-    <ClInclude Include="audioresample.h" />
-    <ClInclude Include="audioresize.h" />
-    <ClInclude Include="audiortp.h" />
-    <ClInclude Include="audiosilencedet.h" />
-    <ClInclude Include="audiostream.h" />
-    <ClInclude Include="audiotone.h" />
-    <ClInclude Include="audiovoxfile.h" />
-    <ClInclude Include="audiowavfile.h" />
-    <ClInclude Include="codec\g729acodec.h" />
-    <ClInclude Include="precompile.h" />
-    <ClInclude Include="codec\adpcmcodec.h" />
-    <ClInclude Include="codec\bvcodec.h" />
-    <ClInclude Include="codec\codecmgr.h" />
-    <ClInclude Include="codec\g711codec.h" />
-    <ClInclude Include="codec\gsmcodec.h" />
-    <ClInclude Include="other\circbuf.h" />
-    <ClInclude Include="other\delaybuf.h" />
-    <ClInclude Include="other\jbuf.h" />
-    <ClInclude Include="other\plc.h" />
-    <ClInclude Include="other\silencedet.h" />
-    <ClInclude Include="other\wsola.h" />
-  </ItemGroup>
-  <ItemGroup>
-    <ResourceCompile Include="..\..\Version.rc" />
-  </ItemGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-  <ImportGroup Label="ExtensionTargets">
-  </ImportGroup>
-</Project>

+ 0 - 296
Other/libaudioframework/libaudioframework.vcxproj.filters

@@ -1,296 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup>
-    <Filter Include="Source Files">
-      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
-      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
-    </Filter>
-    <Filter Include="Source Files\codec">
-      <UniqueIdentifier>{31e968cc-5080-4f41-a26c-6d1e7e23792b}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="Source Files\other">
-      <UniqueIdentifier>{ef1f0121-4315-4635-8b1f-dfc44847179e}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="Header Files">
-      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
-      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
-    </Filter>
-    <Filter Include="Header Files\codec">
-      <UniqueIdentifier>{68a1816c-5706-46cf-a53f-21a0ba9a040b}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="Header Files\other">
-      <UniqueIdentifier>{08b7185c-2976-4e5c-90fe-c0d71c9b5620}</UniqueIdentifier>
-    </Filter>
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="audioaec.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audiobridge.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audiocache.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audiocodec.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audiocommon.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audioconf.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audiocontext.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audiocustom.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audiodbmeter.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audiodriver.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audiodrivergroup.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audiodsp.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audiodtmf.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audiodtmfbridge.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audioengine.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audiofax.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audiofile.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audiolog.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audiomicspk.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audiomixer.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audiorecply.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audioresample.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audioresize.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audiortp.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audiosilencedet.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audiostream.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audiotone.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audiovoxfile.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audiowavfile.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="precompile.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="codec\adpcmcodec.c">
-      <Filter>Source Files\codec</Filter>
-    </ClCompile>
-    <ClCompile Include="codec\bvcodec.c">
-      <Filter>Source Files\codec</Filter>
-    </ClCompile>
-    <ClCompile Include="codec\codecmgr.c">
-      <Filter>Source Files\codec</Filter>
-    </ClCompile>
-    <ClCompile Include="codec\g711codec.c">
-      <Filter>Source Files\codec</Filter>
-    </ClCompile>
-    <ClCompile Include="codec\gsmcodec.c">
-      <Filter>Source Files\codec</Filter>
-    </ClCompile>
-    <ClCompile Include="other\delaybuf.c">
-      <Filter>Source Files\other</Filter>
-    </ClCompile>
-    <ClCompile Include="other\jbuf.c">
-      <Filter>Source Files\other</Filter>
-    </ClCompile>
-    <ClCompile Include="other\plc.c">
-      <Filter>Source Files\other</Filter>
-    </ClCompile>
-    <ClCompile Include="other\silencedet.c">
-      <Filter>Source Files\other</Filter>
-    </ClCompile>
-    <ClCompile Include="other\wsola.c">
-      <Filter>Source Files\other</Filter>
-    </ClCompile>
-    <ClCompile Include="codec\g729acodec.c">
-      <Filter>Source Files\codec</Filter>
-    </ClCompile>
-    <ClCompile Include="audiomicspk2.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="audiomicspk3.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="audioaec.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audiobridge.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audiocache.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audiocodec.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audiocommon.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audioconf.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audiocontext.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audiocustom.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audiodbmeter.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audiodriver.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audiodrivergroup.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audiodsp.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audiodtmf.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audiodtmfbridge.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audioengine.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audiofax.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audiofile.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audioframe.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audioframework.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audiolog.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audiomicspk.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audiomixer.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audiorecply.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audioresample.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audioresize.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audiortp.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audiosilencedet.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audiostream.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audiotone.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audiovoxfile.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audiowavfile.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="precompile.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="codec\adpcmcodec.h">
-      <Filter>Header Files\codec</Filter>
-    </ClInclude>
-    <ClInclude Include="codec\bvcodec.h">
-      <Filter>Header Files\codec</Filter>
-    </ClInclude>
-    <ClInclude Include="codec\codecmgr.h">
-      <Filter>Header Files\codec</Filter>
-    </ClInclude>
-    <ClInclude Include="codec\g711codec.h">
-      <Filter>Header Files\codec</Filter>
-    </ClInclude>
-    <ClInclude Include="codec\gsmcodec.h">
-      <Filter>Header Files\codec</Filter>
-    </ClInclude>
-    <ClInclude Include="other\circbuf.h">
-      <Filter>Header Files\other</Filter>
-    </ClInclude>
-    <ClInclude Include="other\delaybuf.h">
-      <Filter>Header Files\other</Filter>
-    </ClInclude>
-    <ClInclude Include="other\jbuf.h">
-      <Filter>Header Files\other</Filter>
-    </ClInclude>
-    <ClInclude Include="other\plc.h">
-      <Filter>Header Files\other</Filter>
-    </ClInclude>
-    <ClInclude Include="other\silencedet.h">
-      <Filter>Header Files\other</Filter>
-    </ClInclude>
-    <ClInclude Include="other\wsola.h">
-      <Filter>Header Files\other</Filter>
-    </ClInclude>
-    <ClInclude Include="codec\g729acodec.h">
-      <Filter>Header Files\codec</Filter>
-    </ClInclude>
-    <ClInclude Include="audiomicspk2.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="audiomicspk3.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-  </ItemGroup>
-</Project>

+ 1 - 0
Other/libaudioframework/precompile.h

@@ -2,6 +2,7 @@
 #define WIN32_LEAN_AND_MEAN
 #include <Mmsystem.h>
 #include <windows.h>
+#include <in6addr.h>
 
 #include <apr_tables.h>
 #include <apr_thread_mutex.h>

+ 54 - 0
Other/libaudioqueue/CMakeLists.txt

@@ -0,0 +1,54 @@
+set(MODULE_NAME "libaudioqueue")
+set(MODULE_PREFIX "LIB_AUDIOQUEUE_FUNC")
+
+
+if(RVC_DEBUG_MODE)
+    set(SPBASE_LIB spbased)
+else()
+    set(SPBASE_LIB spbase)
+endif(RVC_DEBUG_MODE)
+
+
+set(${MODULE_PREFIX}_SRCS
+    libaudioqueue.h
+	#dllmain.cpp
+    libaudioqueue.cpp
+	stdafx.cpp
+)
+
+add_library(${MODULE_NAME} SHARED ${${MODULE_PREFIX}_SRCS})
+
+add_precompiled_header(${MODULE_NAME} stdafx.h SOURCE_CXX stdafx.cpp FORCEINCLUDE)
+
+target_include_directories(${MODULE_NAME} PRIVATE
+	"${CONAN_RVCFRAMEWORK_ROOT}/include"
+	${RVC_COMMON_INCLUDE_DIR}
+	)
+
+message(STATUS "rvc common include dir is ${RVC_COMMON_INCLUDE_DIR}")
+
+target_link_directories(${MODULE_NAME} PRIVATE
+	${CONAN_LIB_DIRS_RVCFRAMEWORK}
+	)
+
+target_link_libraries(${MODULE_NAME} PRIVATE ${${MODULE_PREFIX}_LIBS}	
+	${SPBASE_LIB}
+	libsharememory
+	)  
+
+
+target_compile_definitions(${MODULE_NAME} PUBLIC "LIBAUDIOQUEUE_EXPORTS")
+
+if(MSVC)
+	install(TARGETS ${MODULE_NAME} 
+    RUNTIME DESTINATION "${RVC_RUNTIME_PATH}" COMPONENT libraries
+    ARCHIVE DESTINATION "${RVC_LIBRARY_PATH}" COMPONENT develops EXCLUDE_FROM_ALL
+    LIBRARY DESTINATION "${RVC_LIBRARY_PATH}" COMPONENT libraries
+    )
+else()
+install(TARGETS ${MODULE_NAME} 
+    RUNTIME DESTINATION "${RVC_RUNTIME_PATH}"
+    ARCHIVE DESTINATION "${RVC_LIBRARY_PATH}"
+    LIBRARY DESTINATION "${RVC_RUNTIME_PATH}"
+    COMPONENT libraries)
+endif(MSVC)

+ 2 - 2
Other/libaudioqueue/libaudioqueue.cpp

@@ -1,9 +1,9 @@
 // libaudioqueue.cpp : 定义 DLL 应用程序的导出函数。
 //
 
-#include "stdafx.h"
+//#include "stdafx.h"
 #include "libaudioqueue.h"
-#include "libsharememory.h"
+#include "../libsharememory/libsharememory.h"
 #include <windows.h>
 
 

+ 0 - 120
Other/libaudioqueue/libaudioqueue.vcxproj

@@ -1,120 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
-  <PropertyGroup Label="Globals">
-    <ProjectGuid>{2AD3370E-8091-40A1-80BA-7DB3AA809CDA}</ProjectGuid>
-    <Keyword>Win32Proj</Keyword>
-    <RootNamespace>libaudioqueue</RootNamespace>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-    <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>Windows7.1SDK</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-    <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>Windows7.1SDK</PlatformToolset>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <Import Project="..\libmake.setting" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <LinkIncremental>true</LinkIncremental>
-    <IncludePath>$(solutiondir)include;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;</IncludePath>
-    <LibraryPath>$(solutiondir)lib;$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib</LibraryPath>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <LinkIncremental>false</LinkIncremental>
-    <IncludePath>$(solutiondir)include;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;</IncludePath>
-    <LibraryPath>$(solutiondir)lib;$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib</LibraryPath>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <ClCompile>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <WarningLevel>Level3</WarningLevel>
-      <Optimization>MaxSpeed</Optimization>
-      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBAUDIOQUEUE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>$(FrameworkHeadRoot)\Common;..\libsharememory</AdditionalIncludeDirectories>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-    </ClCompile>
-    <Link>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-    </Link>
-    <PostBuildEvent />
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <WarningLevel>Level3</WarningLevel>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <Optimization>MaxSpeed</Optimization>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBAUDIOQUEUE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>$(FrameworkHeadRoot)\Common;..\libsharememory</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <ImportLibrary>$(SolutionDir)Temp\Compile\$(Projectname)\$(Configuration)\$(TargetName).lib</ImportLibrary>
-    </Link>
-    <PostBuildEvent />
-  </ItemDefinitionGroup>
-  <ItemGroup>
-    <None Include="ReadMe.txt" />
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="$(FrameworkHeadRoot)\Common\stdafx.h" />
-    <ClInclude Include="libaudioqueue.h" />
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="$(FrameworkHeadRoot)\Common\stdafx.cpp">
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
-    </ClCompile>
-    <ClCompile Include="dllmain.cpp">
-      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"></PrecompiledHeader>
-      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"></PrecompiledHeader>
-    </ClCompile>
-    <ClCompile Include="libaudioqueue.cpp" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\libsharememory\libsharememory.vcxproj">
-      <Project>{5b4b7c43-3e8d-4523-91a7-b2943240abd3}</Project>
-    </ProjectReference>
-  </ItemGroup>
-  <ItemGroup>
-    <ResourceCompile Include="..\..\Version.rc" />
-  </ItemGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-  <ImportGroup Label="ExtensionTargets">
-  </ImportGroup>
-</Project>

+ 0 - 39
Other/libaudioqueue/libaudioqueue.vcxproj.filters

@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup>
-    <Filter Include="源文件">
-      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
-      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
-    </Filter>
-    <Filter Include="头文件">
-      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
-      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
-    </Filter>
-    <Filter Include="资源文件">
-      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
-      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
-    </Filter>
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="ReadMe.txt" />
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="libaudioqueue.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\Framework\Common\stdafx.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="libaudioqueue.cpp">
-      <Filter>源文件</Filter>
-    </ClCompile>
-    <ClCompile Include="dllmain.cpp">
-      <Filter>源文件</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\Framework\Common\stdafx.cpp">
-      <Filter>源文件</Filter>
-    </ClCompile>
-  </ItemGroup>
-</Project>

+ 8 - 0
Other/libaudioqueue/stdafx.cpp

@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+// SpBase.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file

+ 71 - 0
Other/libaudiorender/CMakeLists.txt

@@ -0,0 +1,71 @@
+set(MODULE_NAME "libaudiorender")
+set(MODULE_PREFIX "LIB_AUDIORENDER_FUNC")
+
+
+if(RVC_DEBUG_MODE)
+    set(SPBASE_LIB spbased)
+else()
+    set(SPBASE_LIB spbase)
+endif(RVC_DEBUG_MODE)
+
+
+set(${MODULE_PREFIX}_SRCS
+    iaudiorenderinterface.h
+    libaudiorender.h
+    stdafx.h
+    targetver.h
+
+	dllmain.cpp
+	iaudiorenderinterface.cpp
+    libaudiorender.cpp
+    stdafx.cpp
+)
+
+add_library(${MODULE_NAME} SHARED ${${MODULE_PREFIX}_SRCS})
+
+
+if(WIN32)
+conan_cmake_run(REQUIRES SpeexDSP/1.2rc3@LR04.02_ThirdParty/testing
+BASIC_SETUP CMAKE_TARGETS
+BUILD missing)
+else(WIN32)
+conan_cmake_run(REQUIRES SpeexDSP/1.2rc3@LR04.02_ThirdParty/testing
+BASIC_SETUP CMAKE_TARGETS
+BUILD missing)
+endif(WIN32)
+
+
+target_include_directories(${MODULE_NAME} PRIVATE
+	"${CONAN_RVCFRAMEWORK_ROOT}/include"
+	${RVC_COMMON_INCLUDE_DIR}
+	${CONAN_INCLUDE_DIRS_SPEEXDSP}
+	)
+
+
+target_link_directories(${MODULE_NAME} PRIVATE
+	${CONAN_LIB_DIRS_RVCFRAMEWORK}
+	${CONAN_LIB_DIRS_SPEEXDSP}
+	)
+
+target_link_libraries(${MODULE_NAME} PRIVATE ${${MODULE_PREFIX}_LIBS} 
+	${SPBASE_LIB}
+	${CONAN_PKG_LIBS_SPEEXDSP}
+	libaudioqueue
+	)  
+
+
+target_compile_definitions(${MODULE_NAME} PUBLIC "LIBAUDIORENDER_EXPORTS")
+
+if(MSVC)
+	install(TARGETS ${MODULE_NAME} 
+    RUNTIME DESTINATION "${RVC_RUNTIME_PATH}" COMPONENT libraries
+    ARCHIVE DESTINATION "${RVC_LIBRARY_PATH}" COMPONENT develops EXCLUDE_FROM_ALL
+    LIBRARY DESTINATION "${RVC_LIBRARY_PATH}" COMPONENT libraries
+    )
+else()
+install(TARGETS ${MODULE_NAME} 
+    RUNTIME DESTINATION "${RVC_RUNTIME_PATH}"
+    ARCHIVE DESTINATION "${RVC_LIBRARY_PATH}"
+    LIBRARY DESTINATION "${RVC_RUNTIME_PATH}"
+    COMPONENT libraries)
+endif(MSVC)

+ 2 - 2
Other/libaudiorender/libaudiorender.h

@@ -1,9 +1,9 @@
 
 #pragma once
 
-#include <speex\speex_resampler.h>
+#include <speex/speex_resampler.h>
 #include "iaudiorenderinterface.h"
-#include "libaudioqueue.h"
+#include "../libaudioqueue/libaudioqueue.h"
 
 #pragma comment(lib,"avrt.lib")
 #include<Audioclient.h>

+ 1 - 1
Other/libsharememory/CMakeLists.txt

@@ -2,13 +2,13 @@ set(MODULE_NAME "libsharememory")
 set(MODULE_PREFIX "LIB_SHAREMEMORY_FUNC")
 
 set(${MODULE_PREFIX}_SRCS
-	dllmain.cpp
 	libsharememory.h
 	libsharememory.cpp
 )
 
 add_library(${MODULE_NAME} SHARED ${${MODULE_PREFIX}_SRCS})
 
+
 target_include_directories(${MODULE_NAME} PRIVATE
 	"${CONAN_RVCFRAMEWORK_ROOT}/include"
 	${RVC_COMMON_INCLUDE_DIR})

+ 215 - 0
Other/libvideoframework/CMakeLists.txt

@@ -0,0 +1,215 @@
+set(MODULE_NAME "libvideoframework")
+set(MODULE_PREFIX "LIB_VIDEOFRAMEWORK_FUNC")
+
+if(RVC_DEBUG_MODE)
+    set(SPBASE_LIB spbased)
+else()
+    set(SPBASE_LIB spbase)
+endif(RVC_DEBUG_MODE)
+
+set(${MODULE_PREFIX}_SRCS
+   adaptive_jitter_buffer/video_jbuff_api.h
+   adaptive_jitter_buffer/video_jbuff_decoding_state.h
+   adaptive_jitter_buffer/video_jbuff_defines.h
+   adaptive_jitter_buffer/video_jbuff_frame.h
+   adaptive_jitter_buffer/video_jbuff_framelist.h
+   adaptive_jitter_buffer/video_jbuff_jitterbuffer.h
+   adaptive_jitter_buffer/video_jbuff_log.h
+   adaptive_jitter_buffer/video_jbuff_packet.h
+   congestion_control/cc/razor_api.h
+   congestion_control/cc/razor_callback.h
+   congestion_control/cc/razor_log.h
+   congestion_control/cc/receiver_congestion_controller.h
+   congestion_control/cc/sender_congestion_controller.h
+   congestion_control/common/cf_crc32.h
+   congestion_control/common/cf_hex.h
+   congestion_control/common/cf_list.h
+   congestion_control/common/cf_platform.h
+   congestion_control/common/cf_skiplist.h
+   congestion_control/common/cf_stream.h
+   congestion_control/common/cf_unwrapper.h
+   congestion_control/estimator/ack_bitrate_estimator.h
+   congestion_control/estimator/aimd_rate_control.h
+   congestion_control/estimator/bitrate_controller.h
+   congestion_control/estimator/cc_feedback_adapter.h
+   congestion_control/estimator/cc_loss_stat.h
+   congestion_control/estimator/delay_base_bwe.h
+   congestion_control/estimator/estimator_common.h
+   congestion_control/estimator/inter_arrival.h
+   congestion_control/estimator/kalman_filter.h
+   congestion_control/estimator/overuse_detector.h
+   congestion_control/estimator/rate_stat.h
+   congestion_control/estimator/remote_bitrate_estimator.h
+   congestion_control/estimator/remote_estimator_proxy.h
+   congestion_control/estimator/sender_bandwidth_estimator.h
+   congestion_control/estimator/sender_history.h
+   congestion_control/estimator/trendline.h
+   congestion_control/pacing/alr_detector.h
+   congestion_control/pacing/interval_budget.h
+   congestion_control/pacing/pacer_queue.h
+   congestion_control/pacing/pace_sender.h
+   congestion_control/sim_transport/sim_external.h
+   congestion_control/sim_transport/sim_internal.h
+   congestion_control/sim_transport/sim_receiver.h
+   congestion_control/sim_transport/sim_sender.h
+   congestion_control/sim_transport/sim_session.h
+   h264_packetizer/h264_packetizer.h
+   rtp_header_extension/byte_io.h
+   rtp_header_extension/rtp_header_extensions.h
+   rtp_header_extension/rtp_header_extension_api.h
+   rtp_header_extension/rtp_header_extension_defines.h
+   rtp_header_extension/rtp_header_extension_map.h
+   rtp_header_extension/rtp_header_extension_packet.h
+   rtp_header_extension/rtp_header_extension_parser.h
+   videocap.h
+   videoclock.h
+   videocommon.h
+   videoframework.h
+   videoplayer.h
+   videorender.h
+   videortp.h
+   videoutil.h
+   videoview.h
+   video_coding/base/exp_filter.h
+   video_coding/base/rate_statistics.h
+   video_coding/base/video_coding_clock.h
+   video_coding/base/video_coding_log.h
+   video_coding/base/video_coding_type_defines.h
+   video_coding/base/video_frame_type.h
+   video_coding/frame_dropper.h
+   video_coding/h264/bit_buffer.h
+   video_coding/h264/h264_bitstream_parser.h
+   video_coding/h264/h264_common.h
+   video_coding/h264/pps_parser.h
+   video_coding/h264/sps_parser.h
+   video_coding/video_decoder.h
+   video_coding/video_encoder.h
+   video_coding/video_encoder_api.h
+   video_coding/video_encoder_defines.h
+   video_coding/video_stream_encoder.h
+   video_common/ffmpeg_api_adapter.h
+   video_common/ffmpeg_api_cpp_adapter.h
+   video_common/videodebugfile.h
+   video_common/video_encoded_image.h
+   video_statics/video_stats.h
+
+
+    adaptive_jitter_buffer/video_jbuff_api.cpp
+    adaptive_jitter_buffer/video_jbuff_decoding_state.cpp
+    adaptive_jitter_buffer/video_jbuff_frame.cpp
+    adaptive_jitter_buffer/video_jbuff_framelist.cpp
+    adaptive_jitter_buffer/video_jbuff_jitterbuffer.cpp
+    adaptive_jitter_buffer/video_jbuff_log.c
+    adaptive_jitter_buffer/video_jbuff_packet.cpp
+    congestion_control/cc/razor_api.c
+    congestion_control/cc/razor_log.c
+    congestion_control/cc/receiver_congestion_controller.c
+    congestion_control/cc/sender_congestion_controller.c
+    congestion_control/common/cf_crc32.c
+    congestion_control/common/cf_hex.c
+    congestion_control/common/cf_list.c
+    congestion_control/common/cf_skiplist.c
+    congestion_control/common/cf_stream.c
+    congestion_control/common/cf_unwrapper.c
+    congestion_control/common/platform/windows/mscc.c
+    congestion_control/estimator/ack_bitrate_estimator.c
+    congestion_control/estimator/aimd_rate_control.c
+    congestion_control/estimator/bitrate_controller.c
+    congestion_control/estimator/cc_feedback_adapter.c
+    congestion_control/estimator/cc_loss_stat.c
+    congestion_control/estimator/delay_base_bwe.c
+    congestion_control/estimator/estimator_common.c
+    congestion_control/estimator/inter_arrival.c
+    congestion_control/estimator/kalman_filter.c
+    congestion_control/estimator/overuse_detector.c
+    congestion_control/estimator/rate_stat.c
+    congestion_control/estimator/remote_bitrate_estimator.c
+    congestion_control/estimator/remote_estimator_proxy.c
+    congestion_control/estimator/sender_bandwidth_estimator.c
+    congestion_control/estimator/sender_history.c
+    congestion_control/estimator/trendline.c
+    congestion_control/pacing/alr_detector.c
+    congestion_control/pacing/interval_budget.c
+    congestion_control/pacing/pacer_queue.c
+    congestion_control/pacing/pace_sender.c
+    congestion_control/sim_transport/sim_external.c
+    congestion_control/sim_transport/sim_receiver.c
+    congestion_control/sim_transport/sim_sender.c
+    congestion_control/sim_transport/sim_session.c
+    h264_packetizer/h264_packetizer.c
+    rtp_header_extension/rtp_header_extensions.cpp
+    rtp_header_extension/rtp_header_extension_api.cpp
+    rtp_header_extension/rtp_header_extension_map.cpp
+    rtp_header_extension/rtp_header_extension_packet.cpp
+    rtp_header_extension/rtp_header_extension_parser.cpp
+    videocap.c
+    videoclock.c
+    videoplayer.c
+    videorender.c
+    videortp.c
+    videoview.c
+    video_coding/base/exp_filter.cpp
+    video_coding/base/rate_statistics.cpp
+    video_coding/base/video_coding_log.c
+    video_coding/frame_dropper.cpp
+    video_coding/h264/bit_buffer.cpp
+    video_coding/h264/h264_bitstream_parser.cpp
+    video_coding/h264/h264_common.cpp
+    video_coding/h264/pps_parser.cpp
+    video_coding/h264/sps_parser.cpp
+    video_coding/video_decoder.c
+    video_coding/video_encoder.cpp
+    video_coding/video_encoder_api.cpp
+    video_coding/video_stream_encoder.cpp
+    video_common/videocommon.c
+    video_common/videodebugfile.c
+    video_common/videoutil.c
+    video_common/video_encoded_image.cpp
+    video_statics/video_stats.c
+	precompile.h
+	precompile.c
+)
+
+add_library(${MODULE_NAME} STATIC ${${MODULE_PREFIX}_SRCS})
+
+#add_precompiled_header(${MODULE_NAME} precompile.h SOURCE_CXX precompile.cpp FORCEINCLUDE)
+
+if(WIN32)
+conan_cmake_run(REQUIRES ffmpeg/4.1@LR04.02_ThirdParty/testing
+BASIC_SETUP CMAKE_TARGETS
+BUILD missing)
+else(WIN32)
+conan_cmake_run(REQUIRES ffmpeg/4.1@LR04.02_ThirdParty/testing
+BASIC_SETUP CMAKE_TARGETS
+BUILD missing)
+endif(WIN32)
+
+
+
+target_include_directories(${MODULE_NAME} PRIVATE
+	${RVC_COMMON_INCLUDE_DIR}
+	${CONAN_INCLUDE_DIRS_FFMPEG}
+	${CONAN_RVCFRAMEWORK_ROOT}/include
+	${RVC_TOOLKIT_INCLUDE_DIR}
+	${RVC_COMMON_INCLUDE_DIR}
+	)
+
+message(STATUS "ffmpeg include dir is ${CONAN_INCLUDE_DIRS_FFMPEG}")
+message(STATUS "toolkit include dir is ${RVC_TOOLKIT_INCLUDE_DIR}")
+message(STATUS "framework root include dir is ${CONAN_RVCFRAMEWORK_ROOT}")
+message(STATUS "common include dir is ${RVC_COMMON_INCLUDE_DIR}")
+
+
+target_link_directories(${MODULE_NAME} PRIVATE
+	${CONAN_LIB_DIRS_FFMPEG}
+	${CONAN_LIB_DIRS_RVCFRAMEWORK}
+	)
+
+
+target_link_libraries(${MODULE_NAME} PRIVATE ${${MODULE_PREFIX}_LIBS}	
+	${CONAN_LIBS_FFMPEG}
+	${SPBASE_LIB}
+	)  
+
+
+target_compile_definitions(${MODULE_NAME} PUBLIC "_XKEYCHECK_H")

+ 4 - 4
Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_api.cpp

@@ -1,8 +1,8 @@
-#include "adaptive_jitter_buffer/video_jbuff_api.h"
-#include "adaptive_jitter_buffer/video_jbuff_jitterbuffer.h"
-#include "adaptive_jitter_buffer/video_jbuff_log.h"
+#include "../adaptive_jitter_buffer/video_jbuff_api.h"
+#include "../adaptive_jitter_buffer/video_jbuff_jitterbuffer.h"
+#include "../adaptive_jitter_buffer/video_jbuff_log.h"
 
-#include "congestion_control/common/cf_platform.h"
+#include "../congestion_control/common/cf_platform.h"
 
 #ifdef __cplusplus
 extern "C" {

+ 1 - 1
Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_api.h

@@ -1,7 +1,7 @@
 #ifndef VIDEO_JITTERBUFFER_API_H_
 #define VIDEO_JITTERBUFFER_API_H_
 
-#include "adaptive_jitter_buffer/video_jbuff_defines.h"
+#include "../adaptive_jitter_buffer/video_jbuff_defines.h"
 
 #ifdef __cplusplus
 extern "C" {

+ 3 - 3
Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_decoding_state.cpp

@@ -1,7 +1,7 @@
-#include "adaptive_jitter_buffer/video_jbuff_decoding_state.h"
+#include "../adaptive_jitter_buffer/video_jbuff_decoding_state.h"
 
-#include "adaptive_jitter_buffer/video_jbuff_frame.h"
-#include "adaptive_jitter_buffer/video_jbuff_packet.h"
+#include "../adaptive_jitter_buffer/video_jbuff_frame.h"
+#include "../adaptive_jitter_buffer/video_jbuff_packet.h"
 
 #include <assert.h>
 

+ 1 - 1
Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_decoding_state.h

@@ -7,7 +7,7 @@
 #include <limits>
 
 #include "stdint.h"
-#include "adaptive_jitter_buffer/video_jbuff_frame.h"
+#include "../adaptive_jitter_buffer/video_jbuff_frame.h"
 
 namespace AJB {
 

+ 1 - 1
Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_defines.h

@@ -1,7 +1,7 @@
 #ifndef VIDEO_JBUFFER_DEFINES_H_
 #define VIDEO_JBUFFER_DEFINES_H_
 
-#include "video_common/video_encoded_image.h"
+#include "../video_common/video_encoded_image.h"
 
 #ifdef __cplusplus
 extern "C" {

+ 2 - 2
Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_frame.cpp

@@ -1,5 +1,5 @@
-#include "adaptive_jitter_buffer/video_jbuff_frame.h"
-#include "adaptive_jitter_buffer/video_jbuff_log.h"
+#include "../adaptive_jitter_buffer/video_jbuff_frame.h"
+#include "../adaptive_jitter_buffer/video_jbuff_log.h"
 
 
 namespace AJB {

+ 2 - 2
Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_frame.h

@@ -1,8 +1,8 @@
 #ifndef VIDEO_JBUFF_FRAME_H
 #define VIDEO_JBUFF_FRAME_H
 
-#include "adaptive_jitter_buffer/video_jbuff_packet.h"
-#include "video_common/video_encoded_image.h"
+#include "../adaptive_jitter_buffer/video_jbuff_packet.h"
+#include "../video_common/video_encoded_image.h"
 
 #include <list>
 

+ 2 - 2
Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_framelist.cpp

@@ -1,5 +1,5 @@
-#include "adaptive_jitter_buffer/video_jbuff_framelist.h"
-#include "adaptive_jitter_buffer/video_jbuff_log.h"
+#include "../adaptive_jitter_buffer/video_jbuff_framelist.h"
+#include "../adaptive_jitter_buffer/video_jbuff_log.h"
 
 
 namespace AJB {

+ 2 - 2
Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_framelist.h

@@ -3,8 +3,8 @@
 
 #include <map>
 #include "stdint.h"
-#include "adaptive_jitter_buffer/video_jbuff_frame.h"
-#include "adaptive_jitter_buffer/video_jbuff_decoding_state.h"
+#include "../adaptive_jitter_buffer/video_jbuff_frame.h"
+#include "../adaptive_jitter_buffer/video_jbuff_decoding_state.h"
 
 namespace AJB {
 

+ 4 - 4
Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_jitterbuffer.cpp

@@ -1,8 +1,8 @@
-#include "adaptive_jitter_buffer/video_jbuff_jitterbuffer.h"
-#include "adaptive_jitter_buffer/video_jbuff_packet.h"
-#include "adaptive_jitter_buffer/video_jbuff_log.h"
+#include "../adaptive_jitter_buffer/video_jbuff_jitterbuffer.h"
+#include "../adaptive_jitter_buffer/video_jbuff_packet.h"
+#include "../adaptive_jitter_buffer/video_jbuff_log.h"
 
-#include "video_coding/base/video_coding_clock.h"
+#include "../video_coding/base/video_coding_clock.h"
 
 #include <iostream>
 

+ 3 - 3
Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_jitterbuffer.h

@@ -1,9 +1,9 @@
 #ifndef VIDEO_JBUFF_JITTERBUFFER_H
 #define VIDEO_JBUFF_JITTERBUFFER_H
 
-#include "adaptive_jitter_buffer/video_jbuff_defines.h"
-#include "adaptive_jitter_buffer/video_jbuff_frame.h"
-#include "adaptive_jitter_buffer/video_jbuff_framelist.h"
+#include "../adaptive_jitter_buffer/video_jbuff_defines.h"
+#include "../adaptive_jitter_buffer/video_jbuff_frame.h"
+#include "../adaptive_jitter_buffer/video_jbuff_framelist.h"
 
 #include <queue>
 

+ 2 - 2
Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_log.c

@@ -1,6 +1,6 @@
 
-#include "adaptive_jitter_buffer/video_jbuff_log.h"
-#include "adaptive_jitter_buffer/video_jbuff_defines.h"
+#include "video_jbuff_log.h"
+#include "video_jbuff_defines.h"
 #include "stdarg.h "
 
 static VideoJBufferLogCallBack g_log_func = {0};

+ 1 - 1
Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_log.h

@@ -1,7 +1,7 @@
 #ifndef VIDEO_JBUFFER_LOG_H_
 #define VIDEO_JBUFFER_LOG_H_
 
-#include "adaptive_jitter_buffer/video_jbuff_defines.h"
+#include "../adaptive_jitter_buffer/video_jbuff_defines.h"
 
 
 #ifdef __cplusplus

+ 2 - 2
Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_packet.cpp

@@ -1,5 +1,5 @@
-#include "adaptive_jitter_buffer/video_jbuff_packet.h"
-#include "adaptive_jitter_buffer/video_jbuff_log.h"
+#include "../adaptive_jitter_buffer/video_jbuff_packet.h"
+#include "../adaptive_jitter_buffer/video_jbuff_log.h"
 
 namespace AJB {
     

+ 2 - 1
Other/libvideoframework/adaptive_jitter_buffer/video_jbuff_packet.h

@@ -2,7 +2,8 @@
 #define VIDEO_JBUFF_PACKET_H
 
 #include <list>
-#include "adaptive_jitter_buffer/video_jbuff_defines.h"
+#include <memory>
+#include "../adaptive_jitter_buffer/video_jbuff_defines.h"
 
 namespace AJB {
     

+ 3 - 3
Other/libvideoframework/congestion_control/cc/razor_api.c

@@ -1,7 +1,7 @@
 
-#include "congestion_control/cc/razor_api.h"
-#include "congestion_control/cc/sender_congestion_controller.h"
-#include "congestion_control/cc/receiver_congestion_controller.h"
+#include "razor_api.h"
+#include "sender_congestion_controller.h"
+#include "receiver_congestion_controller.h"
 
 
 static void razor_sender_heartbeat(razor_sender_t* sender)

+ 1 - 1
Other/libvideoframework/congestion_control/cc/razor_api.h

@@ -15,7 +15,7 @@ extern "C" {
 **************************************************************/
 
 /*¶¨Ò廨µ÷º¯ÊýºÍ¶ÔÏó*/
-#include "congestion_control/cc/razor_callback.h"
+#include "razor_callback.h"
 
 enum
 {

+ 3 - 3
Other/libvideoframework/congestion_control/cc/razor_log.c

@@ -1,7 +1,7 @@
 
-#include "congestion_control/cc/razor_log.h"
-#include "congestion_control/cc/razor_api.h"
-#include "congestion_control/common/cf_platform.h"
+#include "razor_log.h"
+#include "razor_api.h"
+#include "../common/cf_platform.h"
 
 static razor_log_func g_log_cb = NULL;
 static void *g_log_user_data = NULL;

+ 1 - 1
Other/libvideoframework/congestion_control/cc/razor_log.h

@@ -3,7 +3,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include "congestion_control/cc/razor_api.h"
+#include "razor_api.h"
 
 void ex_razor_log(int level, const char* file, int line, const char *fmt, ...);
 

+ 2 - 2
Other/libvideoframework/congestion_control/cc/receiver_congestion_controller.c

@@ -1,6 +1,6 @@
 
-#include "congestion_control/cc/receiver_congestion_controller.h"
-#include "congestion_control/cc/razor_log.h"
+#include "receiver_congestion_controller.h"
+#include "razor_log.h"
 
 receiver_cc_t* receiver_cc_create(int min_bitrate, int max_bitrate, int packet_header_size, void* handler, send_feedback_func cb)
 {

+ 4 - 4
Other/libvideoframework/congestion_control/cc/receiver_congestion_controller.h

@@ -1,10 +1,10 @@
 #ifndef __receiver_congestion_controller_h_
 #define __receiver_congestion_controller_h_
 
-#include "congestion_control/estimator/remote_estimator_proxy.h"
-#include "congestion_control/estimator/remote_bitrate_estimator.h"
-#include "congestion_control/estimator/cc_loss_stat.h"
-#include "congestion_control/cc/razor_api.h"
+#include "../estimator/remote_estimator_proxy.h"
+#include "../estimator/remote_bitrate_estimator.h"
+#include "../estimator/cc_loss_stat.h"
+#include "razor_api.h"
 
 typedef struct
 {

+ 2 - 2
Other/libvideoframework/congestion_control/cc/sender_congestion_controller.c

@@ -1,6 +1,6 @@
 
-#include "congestion_control/cc/sender_congestion_controller.h"
-#include "congestion_control/cc/razor_log.h"
+#include "sender_congestion_controller.h"
+#include "razor_log.h"
 
 #define k_max_queue_ms		250
 #define k_min_bitrate_bps	10000

+ 6 - 6
Other/libvideoframework/congestion_control/cc/sender_congestion_controller.h

@@ -1,13 +1,13 @@
 #ifndef __sender_congestion_controller_h_
 #define __sender_congestion_controller_h_
 
-#include "congestion_control/estimator/cc_feedback_adapter.h"
-#include "congestion_control/estimator/delay_base_bwe.h"
-#include "congestion_control/estimator/bitrate_controller.h"
-#include "congestion_control/pacing/pace_sender.h"
-#include "congestion_control/estimator/ack_bitrate_estimator.h"
+#include "../estimator/cc_feedback_adapter.h"
+#include "../estimator/delay_base_bwe.h"
+#include "../estimator/bitrate_controller.h"
+#include "../pacing/pace_sender.h"
+#include "../estimator/ack_bitrate_estimator.h"
 
-#include "congestion_control/cc/razor_api.h"
+#include "../cc/razor_api.h"
 
 typedef struct
 {

+ 1 - 1
Other/libvideoframework/congestion_control/common/cf_crc32.c

@@ -1,5 +1,5 @@
 
-#include "congestion_control/common/cf_crc32.h"
+#include "cf_crc32.h"
 
 static uint32_t crc32_tab[] = {
 	0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,

+ 1 - 1
Other/libvideoframework/congestion_control/common/cf_hex.c

@@ -1,5 +1,5 @@
 
-#include "congestion_control/common/cf_hex.h"
+#include "cf_hex.h"
 
 const char *asc_map[256] =
 {

+ 1 - 1
Other/libvideoframework/congestion_control/common/cf_list.c

@@ -1,7 +1,7 @@
 
 #include <stdlib.h>
 #include <assert.h>
-#include "congestion_control/common/cf_list.h"
+#include "cf_list.h"
 
 base_list_t* create_list()
 {

+ 1 - 1
Other/libvideoframework/congestion_control/common/cf_skiplist.c

@@ -3,7 +3,7 @@
 #include <assert.h>
 #include <stdio.h>
 #include <string.h>
-#include "congestion_control/common/cf_skiplist.h"
+#include "cf_skiplist.h"
 
 
 static uint32_t wb_skip_depth()

+ 1 - 1
Other/libvideoframework/congestion_control/common/cf_stream.c

@@ -1,7 +1,7 @@
 
 #include <string.h>
 #include <stdlib.h>
-#include "congestion_control/common/cf_stream.h"
+#include "../common/cf_stream.h"
 #include <assert.h>
 
 #define DEFAULT_PACKET_SIZE 1024

+ 1 - 1
Other/libvideoframework/congestion_control/common/cf_unwrapper.c

@@ -1,5 +1,5 @@
 
-#include "congestion_control/common/cf_unwrapper.h"
+#include "../common/cf_unwrapper.h"
 #include <assert.h>
 
 #define UINT32_MAX_VAL 0XFFFFFFFF

+ 1 - 1
Other/libvideoframework/congestion_control/common/platform/windows/mscc.c

@@ -3,7 +3,7 @@
 #include <ws2tcpip.h>
 #include <windows.h>
 #include <process.h> 
-#include "congestion_control/common/cf_platform.h"
+#include "../../../common/cf_platform.h"
 
 /*fuck vs-2013*/
 #pragma warning(disable: 4996)

+ 2 - 2
Other/libvideoframework/congestion_control/estimator/ack_bitrate_estimator.c

@@ -1,7 +1,7 @@
 
 #include <stdio.h>
-#include "congestion_control/estimator/ack_bitrate_estimator.h"
-#include "congestion_control/common/cf_platform.h"
+#include "ack_bitrate_estimator.h"
+#include "../common/cf_platform.h"
 
 #define k_initial_rate_wnd_ms 500
 #define k_rate_wnd_ms 150

+ 1 - 1
Other/libvideoframework/congestion_control/estimator/ack_bitrate_estimator.h

@@ -1,7 +1,7 @@
 #ifndef __ack_bitrate_estimator_h_
 #define __ack_bitrate_estimator_h_
 
-#include "congestion_control/estimator/estimator_common.h"
+#include "estimator_common.h"
 
 /*通过接收端反馈的收包信息来估算本端发送的有效码率*/
 typedef struct

+ 2 - 2
Other/libvideoframework/congestion_control/estimator/aimd_rate_control.c

@@ -1,6 +1,6 @@
 
-#include "congestion_control/estimator/aimd_rate_control.h"
-#include "congestion_control/cc/razor_log.h"
+#include "../estimator/aimd_rate_control.h"
+#include "../cc/razor_log.h"
 #include <math.h>
 #include <assert.h>
 

+ 2 - 2
Other/libvideoframework/congestion_control/estimator/aimd_rate_control.h

@@ -2,8 +2,8 @@
 #define __aimd_rate_control_h_
 
 #include <stdint.h>
-#include "congestion_control/common/cf_platform.h"
-#include "congestion_control/estimator/estimator_common.h"
+#include "../common/cf_platform.h"
+#include "estimator_common.h"
 
 typedef struct
 {

+ 2 - 2
Other/libvideoframework/congestion_control/estimator/bitrate_controller.c

@@ -1,6 +1,6 @@
 
-#include "congestion_control/estimator/bitrate_controller.h"
-#include "congestion_control/cc/razor_log.h"
+#include "../estimator/bitrate_controller.h"
+#include "../cc/razor_log.h"
 
 /*´¥·¢ÉϲãµÄpacerºÍvideosource¸Ä±äÂëÂÊ*/
 static void inline maybe_trigger_network_changed(bitrate_controller_t* ctrl)

+ 2 - 2
Other/libvideoframework/congestion_control/estimator/bitrate_controller.h

@@ -1,8 +1,8 @@
 #ifndef __bitrate_controller_h_
 #define __bitrate_controller_h_
 
-#include "congestion_control/estimator/sender_bandwidth_estimator.h"
-#include "congestion_control/cc/razor_api.h"
+#include "sender_bandwidth_estimator.h"
+#include "../cc/razor_api.h"
 
 /*发送端码率控制器,会根据REMB/base delay和网络反馈报文调节和控制发送带宽*/
 typedef struct

+ 2 - 2
Other/libvideoframework/congestion_control/estimator/cc_feedback_adapter.c

@@ -1,7 +1,7 @@
 
 #include <stdlib.h>
-#include "congestion_control/estimator/cc_feedback_adapter.h"
-#include "congestion_control/cc/razor_log.h"
+#include "../estimator/cc_feedback_adapter.h"
+#include "../cc/razor_log.h"
 
 #define k_history_cache_ms		60000
 void cc_feedback_adapter_init(feedback_adapter_t* adapter)

+ 1 - 1
Other/libvideoframework/congestion_control/estimator/cc_feedback_adapter.h

@@ -1,7 +1,7 @@
 #ifndef __cc_feedback_adapter_h_
 #define __cc_feedback_adapter_h_
 
-#include "congestion_control/estimator/sender_history.h"
+#include "sender_history.h"
 
 #define FEEDBACK_RTT_WIN_SIZE 32
 typedef struct

+ 2 - 2
Other/libvideoframework/congestion_control/estimator/cc_loss_stat.c

@@ -1,6 +1,6 @@
 
-#include "congestion_control/estimator/cc_loss_stat.h"
-#include "congestion_control/cc/razor_log.h"
+#include "../estimator/cc_loss_stat.h"
+#include "../cc/razor_log.h"
 
 #define k_loss_statistics_window_ms 500
 

+ 2 - 2
Other/libvideoframework/congestion_control/estimator/cc_loss_stat.h

@@ -2,8 +2,8 @@
 #define __cc_loss_stat_h_
 
 #include <stdint.h>
-#include "congestion_control/common/cf_platform.h"
-#include "congestion_control/common/cf_unwrapper.h"
+#include "../common/cf_platform.h"
+#include "../common/cf_unwrapper.h"
 
 /*接收端统计丢包,没有采用webRTC中比较复杂的方式,而是采用了一种简单近似的方式来实现*/
 typedef struct

+ 2 - 2
Other/libvideoframework/congestion_control/estimator/delay_base_bwe.c

@@ -1,6 +1,6 @@
 
-#include "congestion_control/estimator/delay_base_bwe.h"
-#include "congestion_control/cc/razor_log.h"
+#include "delay_base_bwe.h"
+#include "../cc/razor_log.h"
 
 #define k_trendline_smoothing_coeff		0.9
 #define k_trendline_threshold_gain		4.0

+ 6 - 6
Other/libvideoframework/congestion_control/estimator/delay_base_bwe.h

@@ -1,12 +1,12 @@
 #ifndef __delay_base_bwe_h_
 #define __delay_base_bwe_h_
 
-#include "congestion_control/common/cf_platform.h"
-#include "congestion_control/estimator/inter_arrival.h"
-#include "congestion_control/estimator/trendline.h"
-#include "congestion_control/estimator/aimd_rate_control.h"
-#include "congestion_control/estimator/estimator_common.h"
-#include "congestion_control/estimator/overuse_detector.h"
+#include "../common/cf_platform.h"
+#include "inter_arrival.h"
+#include "trendline.h"
+#include "aimd_rate_control.h"
+#include "estimator_common.h"
+#include "overuse_detector.h"
 
 #define k_stream_timeout_ms 2000
 

+ 1 - 1
Other/libvideoframework/congestion_control/estimator/estimator_common.c

@@ -1,5 +1,5 @@
 
-#include "congestion_control/estimator/estimator_common.h"
+#include "../estimator/estimator_common.h"
 
 void feedback_msg_encode(bin_stream_t* strm, feedback_msg_t* msg)
 {

+ 1 - 1
Other/libvideoframework/congestion_control/estimator/estimator_common.h

@@ -1,7 +1,7 @@
 #ifndef __estimator_common_h_
 #define __estimator_common_h_
 #include <stdint.h>
-#include "congestion_control/common/cf_stream.h"
+#include "../common/cf_stream.h"
 
 enum {
 	kBwNormal = 0,

+ 3 - 3
Other/libvideoframework/congestion_control/estimator/inter_arrival.c

@@ -1,8 +1,8 @@
 
 #include <stdio.h>
-#include "congestion_control/estimator/inter_arrival.h"
-#include "congestion_control/common/cf_platform.h"
-#include "congestion_control/cc/razor_log.h"
+#include "../estimator/inter_arrival.h"
+#include "../common/cf_platform.h"
+#include "../cc/razor_log.h"
 
 #define BURST_THRESHOLD_MS	5
 

+ 3 - 3
Other/libvideoframework/congestion_control/estimator/kalman_filter.c

@@ -1,7 +1,7 @@
 
-#include "congestion_control/estimator/kalman_filter.h"
-#include "congestion_control/estimator/estimator_common.h"
-#include "congestion_control/cc/razor_log.h"
+#include "../estimator/kalman_filter.h"
+#include "../estimator/estimator_common.h"
+#include "../cc/razor_log.h"
 
 #include <math.h>
 

+ 2 - 2
Other/libvideoframework/congestion_control/estimator/kalman_filter.h

@@ -1,8 +1,8 @@
 #ifndef __kalman_filter_h_
 #define __kalman_filter_h_
 
-#include "congestion_control/common/cf_platform.h"
-#include "congestion_control/common/cf_list.h"
+#include "../common/cf_platform.h"
+#include "../common/cf_list.h"
 
 /*基于延迟间距的kalman filter实现,主要是通过kalman filter来确定未来网络排队延迟,通过这个排队延迟参数判断网络负载状态*/
 

+ 3 - 3
Other/libvideoframework/congestion_control/estimator/overuse_detector.c

@@ -1,7 +1,7 @@
 
-#include "congestion_control/estimator/overuse_detector.h"
-#include "congestion_control/common/cf_platform.h"
-#include "congestion_control/cc/razor_log.h"
+#include "../estimator/overuse_detector.h"
+#include "../common/cf_platform.h"
+#include "../cc/razor_log.h"
 
 #include <math.h>
 #include <stdlib.h>

+ 1 - 1
Other/libvideoframework/congestion_control/estimator/overuse_detector.h

@@ -1,7 +1,7 @@
 #ifndef __overuse_detector_h_
 #define __overuse_detector_h_
 
-#include "congestion_control/estimator/estimator_common.h"
+#include "estimator_common.h"
 #include <stdint.h>
 
 /*网络过载检测器,移植于webRTC*/

+ 1 - 1
Other/libvideoframework/congestion_control/estimator/rate_stat.c

@@ -1,5 +1,5 @@
 
-#include "congestion_control/estimator/rate_stat.h"
+#include "../estimator/rate_stat.h"
 
 void rate_stat_init(rate_stat_t* rate, int wnd_size, float scale)
 {

+ 1 - 1
Other/libvideoframework/congestion_control/estimator/rate_stat.h

@@ -1,7 +1,7 @@
 #ifndef __rate_stat_h_
 #define __rate_stat_h_
 
-#include "congestion_control/common/cf_platform.h"
+#include "../common/cf_platform.h"
 
 #ifdef __cplusplus
 extern "C" {

+ 2 - 2
Other/libvideoframework/congestion_control/estimator/remote_bitrate_estimator.c

@@ -1,6 +1,6 @@
 
-#include "congestion_control/estimator/remote_bitrate_estimator.h"
-#include "congestion_control/cc/razor_log.h"
+#include "../estimator/remote_bitrate_estimator.h"
+#include "../cc/razor_log.h"
 
 #define k_min_bitrate					64000	  /*8KB/S*/
 #define k_max_bitrate					12800000  /*1.6MB/S*/

+ 8 - 8
Other/libvideoframework/congestion_control/estimator/remote_bitrate_estimator.h

@@ -1,14 +1,14 @@
 #ifndef __remote_bitrate_estimator_h_
 #define __remote_bitrate_estimator_h_
 
-#include "congestion_control/estimator/aimd_rate_control.h"
-#include "congestion_control/estimator/inter_arrival.h"
-#include "congestion_control/estimator/overuse_detector.h"
-#include "congestion_control/estimator/kalman_filter.h"
-#include "congestion_control/common/cf_stream.h"
-#include "congestion_control/estimator/rate_stat.h"
-
-#include "congestion_control/estimator/trendline.h"
+#include "aimd_rate_control.h"
+#include "inter_arrival.h"
+#include "overuse_detector.h"
+#include "kalman_filter.h"
+#include "../common/cf_stream.h"
+#include "rate_stat.h"
+
+#include "trendline.h"
 
 
 /*接收端利用卡尔曼算法和aimd来评估发送端带宽,然后通过REMB方式反馈给发送端进行带宽调节,这里只是做一个可选测试*/

+ 1 - 1
Other/libvideoframework/congestion_control/estimator/remote_estimator_proxy.c

@@ -1,5 +1,5 @@
 
-#include "congestion_control/estimator/remote_estimator_proxy.h"
+#include "../estimator/remote_estimator_proxy.h"
 
 #define kMaxSendIntervalMs 250
 #define kMinSendIntervalMs 10

+ 5 - 5
Other/libvideoframework/congestion_control/estimator/remote_estimator_proxy.h

@@ -1,11 +1,11 @@
 #ifndef __remote_estimator_proxy_h_
 #define __remote_estimator_proxy_h_
 
-#include "congestion_control/estimator/estimator_common.h"
-#include "congestion_control/common/cf_skiplist.h"
-#include "congestion_control/common/cf_platform.h"
-#include "congestion_control/common/cf_unwrapper.h"
-#include "congestion_control/common/cf_stream.h"
+#include "estimator_common.h"
+#include "../common/cf_skiplist.h"
+#include "../common/cf_platform.h"
+#include "../common/cf_unwrapper.h"
+#include "../common/cf_stream.h"
 
 typedef struct
 {

+ 2 - 2
Other/libvideoframework/congestion_control/estimator/sender_bandwidth_estimator.c

@@ -1,6 +1,6 @@
 
-#include "congestion_control/estimator/sender_bandwidth_estimator.h"
-#include "congestion_control/cc/razor_log.h"
+#include "../estimator/sender_bandwidth_estimator.h"
+#include "../cc/razor_log.h"
 
 #define k_low_loss_threshold			0.02f
 #define k_high_loss_threshold			0.1f

+ 2 - 2
Other/libvideoframework/congestion_control/estimator/sender_bandwidth_estimator.h

@@ -1,8 +1,8 @@
 #ifndef __sender_bandwidth_estimator_h_
 #define __sender_bandwidth_estimator_h_
 
-#include "congestion_control/estimator/estimator_common.h"
-#include "congestion_control/common/cf_platform.h"
+#include "estimator_common.h"
+#include "../common/cf_platform.h"
 
 #define LOSS_WND_SIZE 20
 typedef struct

+ 1 - 1
Other/libvideoframework/congestion_control/estimator/sender_history.c

@@ -1,5 +1,5 @@
 
-#include "congestion_control/estimator/sender_history.h"
+#include "../estimator/sender_history.h"
 
 static void free_packet_feedback(skiplist_item_t key, skiplist_item_t val, void* args)
 {

+ 4 - 4
Other/libvideoframework/congestion_control/estimator/sender_history.h

@@ -1,10 +1,10 @@
 #ifndef __sender_history_h_
 #define __sender_history_h_
 
-#include "congestion_control/estimator/estimator_common.h"
-#include "congestion_control/common/cf_platform.h"
-#include "congestion_control/common/cf_skiplist.h"
-#include "congestion_control/common/cf_unwrapper.h"
+#include "../estimator/estimator_common.h"
+#include "../common/cf_platform.h"
+#include "../common/cf_skiplist.h"
+#include "../common/cf_unwrapper.h"
 
 typedef struct
 {

+ 2 - 2
Other/libvideoframework/congestion_control/estimator/trendline.c

@@ -1,6 +1,6 @@
 
-#include "congestion_control/estimator/trendline.h"
-#include "congestion_control/cc/razor_log.h"
+#include "../estimator/trendline.h"
+#include "../cc/razor_log.h"
 
 
 /*计算曲线斜率来确定过载问题*/

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно