diff options
author | Chris Robinson <[email protected]> | 2021-05-19 15:55:27 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2021-05-20 23:48:43 -0700 |
commit | 0ec549ae7a72e35fec739af4eaae0714dd5d0bab (patch) | |
tree | 8db00e730328a94b05ab8cdb7ef5c86c8fe364e6 /examples/alffplay.cpp | |
parent | 4733c9fc37386747abaa994076cb9d287e587357 (diff) |
Fix short initial packet preparation in alffplay
Diffstat (limited to 'examples/alffplay.cpp')
-rw-r--r-- | examples/alffplay.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
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<std::mutex> 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: "<<ret <<std::endl; + return ret; + } if(ret != AVERROR(EAGAIN)) { if(ret < 0) @@ -1470,7 +1474,11 @@ void VideoState::updateVideo(SDL_Window *screen, SDL_Renderer *renderer, bool re break; Picture *nextvp{&mPictQ[next_idx]}; if(clocktime < nextvp->mPts) - break; + { + /* For the first update, ensure the first frame gets shown. */ + if(!mFirstUpdate || vp) + break; + } vp = nextvp; updated = true; |