Skip to content

Commit

Permalink
fix crash if flush a decoder not open
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed Oct 25, 2013
1 parent 2a36aa6 commit a9d67e2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/AVDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,11 @@ bool AVDecoder::isOpen() const

void AVDecoder::flush()
{
if (isAvailable())
avcodec_flush_buffers(d_func().codec_ctx);
if (!isAvailable())
return;
if (!isOpen())
return;
avcodec_flush_buffers(d_func().codec_ctx);
}

void AVDecoder::setCodecContext(AVCodecContext *codecCtx)
Expand Down

0 comments on commit a9d67e2

Please sign in to comment.