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

FS-5011 add sync up flags so neither file writes data until audio is moving both ways

上级 3b6ae896
...@@ -1090,6 +1090,8 @@ struct record_helper { ...@@ -1090,6 +1090,8 @@ struct record_helper {
switch_file_handle_t in_fh; switch_file_handle_t in_fh;
switch_file_handle_t out_fh; switch_file_handle_t out_fh;
int native; int native;
int rready;
int wready;
uint32_t packet_len; uint32_t packet_len;
int min_sec; int min_sec;
switch_bool_t hangup_on_error; switch_bool_t hangup_on_error;
...@@ -1115,16 +1117,24 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s ...@@ -1115,16 +1117,24 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
break; break;
case SWITCH_ABC_TYPE_TAP_NATIVE_READ: case SWITCH_ABC_TYPE_TAP_NATIVE_READ:
{ {
nframe = switch_core_media_bug_get_native_read_frame(bug); rh->rready = 1;
len = nframe->datalen;
switch_core_file_write(&rh->in_fh, nframe->data, &len); if (rh->rready && rh->wready) {
nframe = switch_core_media_bug_get_native_read_frame(bug);
len = nframe->datalen;
switch_core_file_write(&rh->in_fh, nframe->data, &len);
}
} }
break; break;
case SWITCH_ABC_TYPE_TAP_NATIVE_WRITE: case SWITCH_ABC_TYPE_TAP_NATIVE_WRITE:
{ {
nframe = switch_core_media_bug_get_native_write_frame(bug); rh->wready = 1;
len = nframe->datalen;
switch_core_file_write(&rh->out_fh, nframe->data, &len); if (rh->rready && rh->wready) {
nframe = switch_core_media_bug_get_native_write_frame(bug);
len = nframe->datalen;
switch_core_file_write(&rh->out_fh, nframe->data, &len);
}
} }
break; break;
case SWITCH_ABC_TYPE_CLOSE: case SWITCH_ABC_TYPE_CLOSE:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论