Skip to content

Commit

Permalink
Handle EAGAIN result from decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
dturner committed Jun 10, 2020
1 parent 0511540 commit 3947bd0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion samples/RhythmGame/src/main/cpp/audio/FFMpegExtractor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,12 @@ int64_t FFMpegExtractor::decode(

// Retrieve our raw data from the codec
result = avcodec_receive_frame(codecContext.get(), decodedFrame);
if (result != 0) {
if (result == AVERROR(EAGAIN)) {
// The codec needs more data before it can decode
avPacket.size = 0;
avPacket.data = nullptr;
continue;
} else if (result != 0) {
LOGE("avcodec_receive_frame error: %s", av_err2str(result));
goto cleanup;
}
Expand Down

0 comments on commit 3947bd0

Please sign in to comment.