summaryrefslogtreecommitdiff
path: root/dom
diff options
context:
space:
mode:
authortrav90 <travawine@palemoon.org>2023-10-25 09:38:26 -0500
committertrav90 <travawine@palemoon.org>2023-10-27 10:16:08 -0500
commit6ee56b0a60cca017a4f124f1f814756b6501c4ab (patch)
treeb118ae25a8488ac50319ccac3466f48f5b8f5bed /dom
parent165ef56547a9944815ae10880c3786b271bdbdb5 (diff)
downloaduxp-6ee56b0a60cca017a4f124f1f814756b6501c4ab.tar.gz
Issue #2317 - Part 9 - "send" before "receive"-ing when decoding audio using FFmpeg
This is what the documentation says we should be doing. We miss decoding a packet otherwise.
Diffstat (limited to 'dom')
-rw-r--r--dom/media/platforms/ffmpeg/FFmpegAudioDecoder.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/dom/media/platforms/ffmpeg/FFmpegAudioDecoder.cpp b/dom/media/platforms/ffmpeg/FFmpegAudioDecoder.cpp
index fa36f00ae5..0cfe83e9ba 100644
--- a/dom/media/platforms/ffmpeg/FFmpegAudioDecoder.cpp
+++ b/dom/media/platforms/ffmpeg/FFmpegAudioDecoder.cpp
@@ -149,35 +149,35 @@ FFmpegAudioDecoder<LIBAV_VER>::DoDecode(MediaRawData* aSample)
}
#else
#define AVRESULT_OK 0
-
- int ret = mLib->avcodec_receive_frame(mCodecContext, mFrame);
+ int ret = mLib->avcodec_send_packet(mCodecContext, &packet);
switch (ret) {
case AVRESULT_OK:
- decoded = true;
+ bytesConsumed = packet.size;
break;
case AVERROR(EAGAIN):
break;
- case AVERROR_EOF: {
+ case AVERROR_EOF:
FFMPEG_LOG("End of stream.");
return MediaResult(NS_ERROR_DOM_MEDIA_END_OF_STREAM,
RESULT_DETAIL("End of stream"));
- }
+ default:
+ NS_WARNING("FFmpeg audio decoder error.");
+ return MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR,
+ RESULT_DETAIL("FFmpeg audio error"));
}
- ret = mLib->avcodec_send_packet(mCodecContext, &packet);
+
+ ret = mLib->avcodec_receive_frame(mCodecContext, mFrame);
switch (ret) {
case AVRESULT_OK:
- bytesConsumed = packet.size;
+ decoded = true;
break;
case AVERROR(EAGAIN):
break;
- case AVERROR_EOF:
+ case AVERROR_EOF: {
FFMPEG_LOG("End of stream.");
return MediaResult(NS_ERROR_DOM_MEDIA_END_OF_STREAM,
RESULT_DETAIL("End of stream"));
- default:
- NS_WARNING("FFmpeg audio decoder error.");
- return MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR,
- RESULT_DETAIL("FFmpeg audio error"));
+ }
}
#endif