X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fffmpeg%2Fffmpeg_pipeline_backend_internal.cpp;h=0329a1662bb012a92595ffb278a2aecbd7bd81f5;hb=e48212a5d56ef6dbff39fbcf44956360fe1576e3;hp=9feb2d734c147d6d7c42a7e999c9d17a94930290;hpb=70235ae09df45c874e133fd4d3fcc1e6e34e993a;p=casparcg diff --git a/modules/ffmpeg/ffmpeg_pipeline_backend_internal.cpp b/modules/ffmpeg/ffmpeg_pipeline_backend_internal.cpp index 9feb2d734..0329a1662 100644 --- a/modules/ffmpeg/ffmpeg_pipeline_backend_internal.cpp +++ b/modules/ffmpeg/ffmpeg_pipeline_backend_internal.cpp @@ -654,6 +654,7 @@ class memory_sink : public sink core::mutable_audio_buffer audio_samples_; std::queue> video_frames_; + std::shared_ptr last_video_frame_; tbb::concurrent_bounded_queue output_frames_; tbb::atomic running_; @@ -816,6 +817,7 @@ public: } auto output_frame = make_frame(this, spl::make_shared_ptr(video_frames_.front()), *factory_, channel_layout_); + last_video_frame_ = video_frames_.front(); video_frames_.pop(); output_frame.audio_data() = std::move(audio_data); @@ -832,9 +834,15 @@ public: audio_data.swap(audio_samples_); + if (video_frames_.empty() && !audio_data.empty() && last_video_frame_) // More audio samples than video + { + video_frames_.push(last_video_frame_); + } + if (!video_frames_.empty()) { auto output_frame = make_frame(this, spl::make_shared_ptr(video_frames_.front()), *factory_, channel_layout_); + last_video_frame_ = video_frames_.front(); video_frames_.pop(); output_frame.audio_data() = std::move(audio_data);