[FFmpeg-trac] #4449(avcodec:new): Error in mpegaudio_parser.c

FFmpeg trac at avcodec.org
Sat Jun 20 02:35:03 CEST 2015


#4449: Error in mpegaudio_parser.c
------------------------------------+-----------------------------------
             Reporter:  Dan203      |                    Owner:
                 Type:  defect      |                   Status:  new
             Priority:  normal      |                Component:  avcodec
              Version:  git-master  |               Resolution:
             Keywords:  mpegaudio   |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+-----------------------------------

Comment (by Dan203):

 Perhaps you're right that my change is not the way to fix it. But the code
 is not working properly even if it is the way the author intended. It
 appears to me that maybe he was trying to ensure that at least 2 headers
 were found before changing the codec ID. The problem is that when you call
 avformat_find_stream_info it only calls mpegaudio_parse once, so the
 author's code...

 int header_threshold = avctx->codec_id != AV_CODEC_ID_NONE &&
 avctx->codec_id != codec_id;

 evaluates to 1 because avctx->codec_id is AV_CODEC_ID_MP3 and codec_id is
 AV_CODEC_ID_MP2. It then increments s->header_count from 0 to 1 and then
 hits this block...

 if (s->header_count > header_threshold) {

 which fails because both s->header_count and header_threshold are now 1.
 s->header_count does not increase to greater then 1 until after the first
 call to av_read_frame which returns an frame from that stream.

 What this means is that there is no way for the user (me) to pre-test a
 file to determine the codecs of all the streams. This worked fine in an
 older version we were using which didn't have the header_threshold test
 and simply did...

 if (s->header_count > 0) {

 I'm not sure why the change was made but it seems to break the ability of
 avformat_find_stream_info to properly determine the codec_id of MP2
 streams.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/4449#comment:5>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list