提交 5a45c863 authored 作者: Seven Du's avatar Seven Du

FS-9115 #resolve #comment trying to support audio only mp4 recording, please test

上级 3c99e139
......@@ -1244,6 +1244,7 @@ struct av_file_context {
switch_timer_t video_timer;
int offset;
int audio_start;
int aud_ready;
int vid_ready;
int audio_ready;
int closed;
......@@ -1861,8 +1862,17 @@ static switch_status_t av_file_write(switch_file_handle_t *handle, void *data, s
}
if (!context->vid_ready) {
if (switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO)) {
switch_buffer_zero(context->audio_buffer);
return status;
} else if (!context->aud_ready) { // audio only recording
int ret = avformat_write_header(context->fc, NULL);
if (ret < 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error occurred when opening output file: %s\n", get_error_text(ret));
return SWITCH_STATUS_FALSE;
}
context->aud_ready = 1;
}
}
if (data && len) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论