libff: Improved handling of EOF in the decoder threads

(Also modifies obs-ffmpeg to handle empty frames on EOF)

Previously the demuxer could hit EOF before the decoder threads are
finished, resulting in truncated output. In the worse case scenario the
demuxer could read small files before ff_decoder_refresh even has a chance
to start the clocks, resulting in no output at all.
This commit is contained in:
Richard Stanway
2016-04-28 23:53:57 +02:00
parent ea851b1351
commit 65fcd20242
5 changed files with 38 additions and 10 deletions

View File

@@ -269,7 +269,7 @@ static bool audio_frame(struct ff_frame *frame, void *opaque)
uint64_t pts;
// Media ended
if (frame == NULL)
if (frame == NULL || frame->frame == NULL)
return true;
pts = (uint64_t)(frame->pts * 1000000000.0L);