[FFmpeg-devel] [PATCH 2/2] avcodec/opus/parser: set sample rate
James Almer
jamrial at gmail.com
Wed Jan 1 17:16:35 EET 2025
Ensures it's set on scenarios where a parser is requested by no decoder is present.
Signed-off-by: James Almer <jamrial at gmail.com>
---
libavcodec/opus/parser.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/libavcodec/opus/parser.c b/libavcodec/opus/parser.c
index 41665e68f9..8c626f6dc2 100644
--- a/libavcodec/opus/parser.c
+++ b/libavcodec/opus/parser.c
@@ -170,9 +170,14 @@ static int opus_parse(AVCodecParserContext *ctx, AVCodecContext *avctx,
{
OpusParserContext *s = ctx->priv_data;
ParseContext *pc = &s->pc;
- int next, header_len;
+ int next, header_len = 0;
- next = opus_find_frame_end(ctx, avctx, buf, buf_size, &header_len);
+ avctx->sample_rate = 48000;
+
+ if (ctx->flags & PARSER_FLAG_COMPLETE_FRAMES)
+ next = buf_size;
+ else
+ next = opus_find_frame_end(ctx, avctx, buf, buf_size, &header_len);
if (s->ts_framing && next != AVERROR_INVALIDDATA &&
ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
--
2.47.1
More information about the ffmpeg-devel
mailing list