[FFmpeg-devel] [PATCH] RTSP muxer, round 5

Michael Niedermayer michaelni
Fri Feb 26 15:42:16 CET 2010


On Fri, Feb 26, 2010 at 03:36:07PM +0200, Martin Storsj? wrote:
> Hi Ronald,
> 
> On Mon, 22 Feb 2010, Ronald S. Bultje wrote:
> 
> > On Fri, Feb 19, 2010 at 6:05 PM, Martin Storsj? <martin at martin.st> wrote:
> > 
> > in write_packet():
> > 
> > +    av_init_packet(&local_pkt);
> > +    local_pkt.stream_index = 0;
> > +    local_pkt.pts   = pkt->pts;
> > +    local_pkt.flags = pkt->flags;
> > +    local_pkt.data  = pkt->data;
> > +    local_pkt.size  = pkt->size;
> > 
> > Is the packet copy necessary? I'm not totally sure, but could you just
> > change pkt->stream_index and forward?
> 
> I noticed one issue regarding this... The current code in SVN changes 
> pkt->stream_index, so a caller doing av_write_frame and then inspecting 
> the packet fields can get confused.
> 
> I had code like this in an external application using libavformat:
> 
>   av_write_frame(out, pkt);
>   double time = pkt->dts*av_q2d(out->streams[pkt->stream_index]->time_base);
> 
> When pkt->stream_index initially was 1, but changed to 0 for the chained 
> internal muxer, this calculation turned out wrong. In this case, it was 
> easy to fix, but there may be a lot of other libavformat users out there 
> that could be struck by something similar.
> 

> So, is it ok for av_write_frame to update fields of the AVPacket to 
> potentially bogus values,

id say, no

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100226/f5fcaecc/attachment.pgp>



More information about the ffmpeg-devel mailing list