On 12/9/24 02:31, Anton Khirnov wrote:
Quoting Scott Theisen (2024-11-30 08:38:54)
On 11/25/24 00:42, Anton Khirnov wrote:
Quoting Scott Theisen (2024-11-14 05:37:49)
@@ -85,7 +85,13 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
                       if (s->header_count > header_threshold) {
                           avctx->sample_rate= sr;
                           av_channel_layout_uninit(&avctx->ch_layout);
-                        av_channel_layout_default(&avctx->ch_layout, channels);
+                        if (dual_mono) {
+                            av_channel_layout_custom_init(&avctx->ch_layout, 
2);
This can fail - the return code should be checked.

It can only fail if av_calloc() fails to allocate 48 bytes.  Should it
return buf_size or just use the default order?
Memory allocation failure should always propagate back to the caller.


The parsers can't return error codes, though.  See line 105 in libavcodec/mpegaudio_parser.c
```
return buf_size; /* parsers must not return error codes */
```

and lines 2911-2916 in libavcodec/avcodec.h
```
/* This callback never returns an error, a negative value means that
 * the frame start was in a previous packet. */
int (*parser_parse)(AVCodecParserContext *s,
                    AVCodecContext *avctx,
                    const uint8_t **poutbuf, int *poutbuf_size,
                    const uint8_t *buf, int buf_size);
```

Regards,

Scott Theisen
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to