From ab98e5177bf328322e594a3efdc86a0dc3225ab2 Mon Sep 17 00:00:00 2001 From: Josh Allmann Date: Wed, 18 Sep 2019 13:00:20 -0700 Subject: [PATCH] fixup! ffmpeg: Fix frame dropping in filtergraph at EOF. --- ffmpeg/ffmpeg_test.go | 3 ++- ffmpeg/lpms_ffmpeg.c | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ffmpeg/ffmpeg_test.go b/ffmpeg/ffmpeg_test.go index b58455d7b4..25cc6e1927 100644 --- a/ffmpeg/ffmpeg_test.go +++ b/ffmpeg/ffmpeg_test.go @@ -1117,6 +1117,7 @@ func TestTranscoder_RepeatedTranscodes(t *testing.T) { func TestTranscoder_MismatchedEncodeDecode(t *testing.T) { // Encoded frame count does not match decoded frame count for mp4 // Note this is not an issue for mpegts! (this is sanity checked) + // See: https://github.com/livepeer/lpms/issues/155 run, dir := setupTest(t) defer os.RemoveAll(dir) @@ -1149,7 +1150,7 @@ func TestTranscoder_MismatchedEncodeDecode(t *testing.T) { // to timestamp rounding around EOF. Note this does not happen with // mpegts formatted output! if res2.Decoded.Frames != 60 || res.Encoded[0].Frames != 61 { - t.Error("Did not get expected frame counts: is this fixed?!? ", + t.Error("Did not get expected frame counts: check if issue #155 is fixed!", res2.Decoded.Frames, res.Encoded[0].Frames) } // Interestingly enough, ffmpeg shows that we have 61 packets but 60 frames. diff --git a/ffmpeg/lpms_ffmpeg.c b/ffmpeg/lpms_ffmpeg.c index 8ce5d340fe..6a2d172cbc 100644 --- a/ffmpeg/lpms_ffmpeg.c +++ b/ffmpeg/lpms_ffmpeg.c @@ -774,8 +774,7 @@ int process_out(struct input_ctx *ictx, struct output_ctx *octx, AVCodecContext if (!filter || !filter->active) { // No filter in between decoder and encoder, so use input frame directly - ret = encode(encoder, inf, octx, ost); - if (ret < 0) return ret; + return encode(encoder, inf, octx, ost); } // Sometimes we have to reset the filter if the HW context is updated