Comment #17 on issue 16020 by ffmpeg: FFmpegDemuxer should be duplicating  
every packet of encoded data
http://code.google.com/p/chromium/issues/detail?id=16020

Hi, scherkus.

I found the reason of "different packet data is mapped to the same pointer"
Please check my patch :
http://codereview.chromium.org/171023

The bug is fired by playing mp3 file (and other related file formats)  
because the
following code "st->need_parsing = AVSTREAM_PARSE_FULL" in mp3 demux:

//libavformat/mp3.c

static int mp3_read_header(AVFormatContext *s,
                            AVFormatParameters *ap)
{
     AVStream *st;
     int64_t off;

     st = av_new_stream(s, 0);
     if (!st)
         return AVERROR(ENOMEM);

     st->codec->codec_type = CODEC_TYPE_AUDIO;
     st->codec->codec_id = CODEC_ID_MP3;
     st->need_parsing = AVSTREAM_PARSE_FULL;
     st->start_time = 0;

     ff_id3v1_read(s);
     ff_id3v2_read(s);

     off = url_ftell(s->pb);
     if (mp3_parse_vbr_tags(s, st, off) < 0)
         url_fseek(s->pb, off, SEEK_SET);

     /* the parameters will be extracted from the compressed bitstream */
     return 0;
}

"st->need_parsing = AVSTREAM_PARSE_FULL" will force FFmpeg's bitstream  
parser to
parse a packet which is obtained by av_read_packet(),

in this case, the packet obtained from av_read_frame() is an inner address  
of
bitstream parser's private data buffer, the bitstream's private data buffer  
is not
available in next calling.

check:
//libavformat/utils.c

                 if (pkt->size) {
                 got_packet:
                     pkt->duration = 0;
                     pkt->stream_index = st->index;
                     pkt->pts = st->parser->pts;
                     pkt->dts = st->parser->dts;
                     pkt->pos = st->parser->pos;
                     pkt->destruct = NULL;
                     compute_pkt_fields(s, st, st->parser, pkt);

                     if((s->iformat->flags & AVFMT_GENERIC_INDEX) &&  
pkt->flags &
PKT_FLAG_KEY){
                         ff_reduce_index(s, st->index);
                         av_add_index_entry(st, st->parser->frame_offset,  
pkt->dts,
                                            0, 0, AVINDEX_KEYFRAME);
                     }

                     break;
                 }

in this case , "pkt->destruct = NULL", this will tell av_dup_packet() to  
clone a
packet in case of the packet is queued for later usage


--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
Automated mail from issue updates at http://crbug.com/
Subscription options: http://groups.google.com/group/chromium-bugs
-~----------~----~----~----~------~----~------~--~---

Reply via email to