提交 c701ce61 authored 作者: Anthony Minessale's avatar Anthony Minessale

FS-9708 #resolve [RTP timing when doing repacketization]

上级 30c84b4b
......@@ -1861,7 +1861,8 @@ typedef enum {
SWITCH_IO_FLAG_NONE = 0,
SWITCH_IO_FLAG_NOBLOCK = (1 << 0),
SWITCH_IO_FLAG_SINGLE_READ = (1 << 1),
SWITCH_IO_FLAG_FORCE = (1 << 2)
SWITCH_IO_FLAG_FORCE = (1 << 2),
SWITCH_IO_FLAG_QUEUED = (1 << 3)
} switch_io_flag_enum_t;
typedef uint32_t switch_io_flag_t;
......
......@@ -1329,7 +1329,11 @@ SWITCH_DECLARE(void) switch_http_parse_qs(switch_http_request_t *request, char *
SWITCH_DECLARE(switch_status_t) switch_frame_buffer_free(switch_frame_buffer_t *fb, switch_frame_t **frameP);
SWITCH_DECLARE(switch_status_t) switch_frame_buffer_dup(switch_frame_buffer_t *fb, switch_frame_t *orig, switch_frame_t **clone);
SWITCH_DECLARE(switch_status_t) switch_frame_buffer_destroy(switch_frame_buffer_t **fbP);
SWITCH_DECLARE(switch_status_t) switch_frame_buffer_create(switch_frame_buffer_t **fbP);
SWITCH_DECLARE(switch_status_t) switch_frame_buffer_create(switch_frame_buffer_t **fbP, switch_size_t qlen);
SWITCH_DECLARE(switch_status_t) switch_frame_buffer_push(switch_frame_buffer_t *fb, void *ptr);
SWITCH_DECLARE(switch_status_t) switch_frame_buffer_trypush(switch_frame_buffer_t *fb, void *ptr);
SWITCH_DECLARE(switch_status_t) switch_frame_buffer_pop(switch_frame_buffer_t *fb, void **ptr);
SWITCH_DECLARE(switch_status_t) switch_frame_buffer_trypop(switch_frame_buffer_t *fb, void **ptr);
typedef struct {
int64_t userms;
......
......@@ -1326,7 +1326,7 @@ void conference_video_write_canvas_image_to_codec_group(conference_obj_t *confer
switch_set_flag(frame, SFF_ENCODED);
if (switch_frame_buffer_dup(imember->fb, frame, &dupframe) == SWITCH_STATUS_SUCCESS) {
if (switch_queue_trypush(imember->mux_out_queue, dupframe) != SWITCH_STATUS_SUCCESS) {
if (switch_frame_buffer_trypush(imember->fb, dupframe) != SWITCH_STATUS_SUCCESS) {
switch_frame_buffer_free(imember->fb, &dupframe);
}
dupframe = NULL;
......@@ -1529,9 +1529,9 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_write_thread_run(switch_thread_
while(conference_utils_member_test_flag(member, MFLAG_RUNNING)) {
if (patched) {
pop_status = switch_queue_trypop(member->mux_out_queue, &pop);
pop_status = switch_frame_buffer_trypop(member->fb, &pop);
} else {
pop_status = switch_queue_pop(member->mux_out_queue, &pop);
pop_status = switch_frame_buffer_pop(member->fb, &pop);
}
if (pop_status == SWITCH_STATUS_SUCCESS) {
......@@ -1599,7 +1599,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_write_thread_run(switch_thread_
}
}
while (switch_queue_trypop(member->mux_out_queue, &pop) == SWITCH_STATUS_SUCCESS) {
while (switch_frame_buffer_trypop(member->fb, &pop) == SWITCH_STATUS_SUCCESS) {
if (pop) {
if ((switch_size_t)pop != 1) {
frame = (switch_frame_t *) pop;
......@@ -2198,7 +2198,7 @@ static void wait_for_canvas(mcu_canvas_t *canvas)
if (layer->need_patch) {
if (layer->member) {
switch_queue_trypush(layer->member->mux_out_queue, (void *) 1);
switch_frame_buffer_trypush(layer->member->fb, (void *) 1);
x++;
} else {
layer->need_patch = 0;
......@@ -2949,7 +2949,9 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
write_frame.packetlen = 0;
if (switch_frame_buffer_dup(imember->fb, &write_frame, &dupframe) == SWITCH_STATUS_SUCCESS) {
switch_queue_push(imember->mux_out_queue, dupframe);
if (switch_frame_buffer_trypush(imember->fb, dupframe) != SWITCH_STATUS_SUCCESS) {
switch_frame_buffer_free(imember->fb, &dupframe);
}
dupframe = NULL;
}
}
......@@ -3139,7 +3141,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
//switch_core_session_write_video_frame(imember->session, &write_frame, SWITCH_IO_FLAG_NONE, 0);
if (switch_frame_buffer_dup(imember->fb, &write_frame, &dupframe) == SWITCH_STATUS_SUCCESS) {
if (switch_queue_trypush(imember->mux_out_queue, dupframe) != SWITCH_STATUS_SUCCESS) {
if (switch_frame_buffer_trypush(imember->fb, dupframe) != SWITCH_STATUS_SUCCESS) {
switch_frame_buffer_free(imember->fb, &dupframe);
}
dupframe = NULL;
......@@ -3487,7 +3489,7 @@ void *SWITCH_THREAD_FUNC conference_video_super_muxing_thread_run(switch_thread_
//switch_core_session_write_video_frame(imember->session, &write_frame, SWITCH_IO_FLAG_NONE, 0);
if (switch_frame_buffer_dup(imember->fb, &write_frame, &dupframe) == SWITCH_STATUS_SUCCESS) {
if (switch_queue_trypush(imember->mux_out_queue, dupframe) != SWITCH_STATUS_SUCCESS) {
if (switch_frame_buffer_trypush(imember->fb, dupframe) != SWITCH_STATUS_SUCCESS) {
switch_frame_buffer_free(imember->fb, &dupframe);
}
dupframe = NULL;
......
......@@ -2297,8 +2297,7 @@ SWITCH_STANDARD_APP(conference_function)
if (conference->conference_video_mode == CONF_VIDEO_MODE_MUX) {
switch_queue_create(&member.video_queue, 200, member.pool);
switch_queue_create(&member.mux_out_queue, 500, member.pool);
switch_frame_buffer_create(&member.fb);
switch_frame_buffer_create(&member.fb, 500);
}
/* Add the caller to the conference */
......@@ -2349,7 +2348,7 @@ SWITCH_STANDARD_APP(conference_function)
if (member.video_muxing_write_thread) {
switch_status_t st = SWITCH_STATUS_SUCCESS;
switch_queue_push(member.mux_out_queue, NULL);
switch_frame_buffer_push(member.fb, NULL);
switch_thread_join(&st, member.video_muxing_write_thread);
member.video_muxing_write_thread = NULL;
}
......
......@@ -750,7 +750,6 @@ struct conference_member {
char *kicked_sound;
switch_queue_t *dtmf_queue;
switch_queue_t *video_queue;
switch_queue_t *mux_out_queue;
switch_thread_t *video_muxing_write_thread;
switch_thread_t *input_thread;
cJSON *json;
......
差异被折叠。
差异被折叠。
......@@ -110,6 +110,7 @@ typedef struct switch_frame_node_s {
struct switch_frame_buffer_s {
switch_frame_node_t *head;
switch_memory_pool_t *pool;
switch_queue_t *queue;
switch_mutex_t *mutex;
uint32_t total;
};
......@@ -164,8 +165,8 @@ static switch_frame_t *find_free_frame(switch_frame_buffer_t *fb, switch_frame_t
np->frame->ssrc = orig->ssrc;
np->frame->m = orig->m;
np->frame->flags = orig->flags;
np->frame->codec = NULL;
np->frame->pmap = NULL;
np->frame->codec = orig->codec;
np->frame->pmap = orig->pmap;
np->frame->img = NULL;
np->frame->extra_data = np;
np->inuse = 1;
......@@ -243,6 +244,26 @@ SWITCH_DECLARE(switch_status_t) switch_frame_buffer_dup(switch_frame_buffer_t *f
return SWITCH_STATUS_SUCCESS;
}
SWITCH_DECLARE(switch_status_t) switch_frame_buffer_push(switch_frame_buffer_t *fb, void *ptr)
{
return switch_queue_push(fb->queue, ptr);
}
SWITCH_DECLARE(switch_status_t) switch_frame_buffer_trypush(switch_frame_buffer_t *fb, void *ptr)
{
return switch_queue_trypush(fb->queue, ptr);
}
SWITCH_DECLARE(switch_status_t) switch_frame_buffer_pop(switch_frame_buffer_t *fb, void **ptr)
{
return switch_queue_pop(fb->queue, ptr);
}
SWITCH_DECLARE(switch_status_t) switch_frame_buffer_trypop(switch_frame_buffer_t *fb, void **ptr)
{
return switch_queue_trypop(fb->queue, ptr);
}
SWITCH_DECLARE(switch_status_t) switch_frame_buffer_destroy(switch_frame_buffer_t **fbP)
{
switch_frame_buffer_t *fb = *fbP;
......@@ -254,14 +275,17 @@ SWITCH_DECLARE(switch_status_t) switch_frame_buffer_destroy(switch_frame_buffer_
return SWITCH_STATUS_SUCCESS;
}
SWITCH_DECLARE(switch_status_t) switch_frame_buffer_create(switch_frame_buffer_t **fbP)
SWITCH_DECLARE(switch_status_t) switch_frame_buffer_create(switch_frame_buffer_t **fbP, switch_size_t qlen)
{
switch_frame_buffer_t *fb;
switch_memory_pool_t *pool;
if (!qlen) qlen = 500;
switch_core_new_memory_pool(&pool);
fb = switch_core_alloc(pool, sizeof(*fb));
fb->pool = pool;
switch_queue_create(&fb->queue, qlen, fb->pool);
switch_mutex_init(&fb->mutex, SWITCH_MUTEX_NESTED, pool);
*fbP = fb;
......@@ -297,9 +321,11 @@ SWITCH_DECLARE(switch_status_t) switch_frame_dup(switch_frame_t *orig, switch_fr
}
new_frame->codec = NULL;
new_frame->pmap = NULL;
new_frame->codec = orig->codec;
new_frame->pmap = orig->pmap;
new_frame->img = NULL;
if (orig->img && !switch_test_flag(orig, SFF_ENCODED)) {
switch_img_copy(orig->img, &new_frame->img);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论