From 0ec549ae7a72e35fec739af4eaae0714dd5d0bab Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 19 May 2021 15:55:27 -0700 Subject: Fix short initial packet preparation in alffplay --- examples/alffplay.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'examples/alffplay.cpp') diff --git a/examples/alffplay.cpp b/examples/alffplay.cpp index c905f51a..556b6909 100644 --- a/examples/alffplay.cpp +++ b/examples/alffplay.cpp @@ -235,9 +235,13 @@ public: std::unique_lock lock{mMutex}; AVPacket *pkt{getPacket(lock)}; - if(!pkt) return avcodec_send_packet(codecctx, nullptr); - const int ret{avcodec_send_packet(codecctx, pkt)}; + if(!pkt) + { + if(!ret) return AVErrorEOF; + std::cerr<< "Failed to send flush packet: "<mPts) - break; + { + /* For the first update, ensure the first frame gets shown. */ + if(!mFirstUpdate || vp) + break; + } vp = nextvp; updated = true; -- cgit v1.2.3