Skip to content

Commit 3947bd0

Browse files
committed
Handle EAGAIN result from decoder
1 parent 0511540 commit 3947bd0

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

samples/RhythmGame/src/main/cpp/audio/FFMpegExtractor.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,12 @@ int64_t FFMpegExtractor::decode(
252252

253253
// Retrieve our raw data from the codec
254254
result = avcodec_receive_frame(codecContext.get(), decodedFrame);
255-
if (result != 0) {
255+
if (result == AVERROR(EAGAIN)) {
256+
// The codec needs more data before it can decode
257+
avPacket.size = 0;
258+
avPacket.data = nullptr;
259+
continue;
260+
} else if (result != 0) {
256261
LOGE("avcodec_receive_frame error: %s", av_err2str(result));
257262
goto cleanup;
258263
}

0 commit comments

Comments
 (0)