Commit 44403df9 authored by NzSN's avatar NzSN

Flush frames in encoders after all stream done.

parent 32cc2d6d
......@@ -275,6 +275,7 @@ int audioMix(char *argv[]) {
filter_ctx.src_
};
int i_ = 0;
const int nb_inputs = 2;
while (1) {
......@@ -293,18 +294,25 @@ int audioMix(char *argv[]) {
if (fin[i] == 1) {
add_to_src(audioContexts[i], srcs[i], NULL, NULL);
} else {
add_to_src(audioContexts[i], srcs[i], packet, frame);
}
add_to_src(audioContexts[i], srcs[i], packet, frame);
av_packet_unref(packet);
i_ = i;
}
}
// Get filtered frames
while ((ret = av_buffersink_get_frame(filter_ctx.sink, frame)) >= 0) {
process_filtered_frames(&o_encoder, frame);
av_frame_unref(frame);
if (fin[i_] == 1) {
process_filtered_frames(&o_encoder, NULL);
} else {
// Get filtered frames
while ((ret = av_buffersink_get_frame(filter_ctx.sink, frame)) >= 0) {
process_filtered_frames(&o_encoder, frame);
av_frame_unref(frame);
}
}
if (fin[0] == 1 && fin[1] == 1) {
......@@ -682,5 +690,7 @@ char* mergeAV(char *videoPath, char *audio_1_path, char *audio_2_path) {
int main(int argc, char *argv[]) {
mergeAV(argv[1], argv[2], argv[3]);
audioMix(argv);
//mergeAV(argv[1], argv[2], argv[3]);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment