[libav-api] Packet Stream Index for UDP Stream

Michael Rice michaelarice at gmail.com
Tue Apr 8 21:03:20 CEST 2014

On Mon, Apr 7, 2014 at 7:15 PM, Luca Barbato <lu_zero at gentoo.org> wrote:

> On 08/04/14 00:24, Michael Rice wrote:
> > Yes, this test is mpegts over UDP. Yes, the new stream comes with a new
> > PID, so I didn't see a way to check if the PIDs match when I get the
> > packet, since the AVPacket only has the stream index.
> Nominally you cannot, since the ts demuxer correctly maps a new pid to a
> new stream. I'm not sure why vlc does that though.
> > The kludge I put in was to initialize the streamIndex to the last video
> > stream in the list (I was initializing it to the first video stream).
> When
> > the AVPacket.stream_index doesn't match, then recheck the stream list in
> > the AVFormatContext to see if a new stream has been added, update my
> stored
> > index to the new last video stream's index, and then compare against the
> > received packet.
> would be much simpler to check nb_streams
> > However, I'd really like to know when a new stream is added, or at least
> > get an error indicator (e.g., an EOF).
> Let me think if there is a mean to deliver the information that is
> better than just checking the nb_streams value.
> lu
> _______________________________________________
> libav-api mailing list
> libav-api at libav.org
> https://lists.libav.org/mailman/listinfo/libav-api

After testing with additional inputs to VLC that have additional streams in
them, and seeing even stranger behavior from VLC, I've changed my client
code to just process every video packet. In practice I will only have a
single video stream, so the changing PID and stream index shouldn't make a
difference; the VLC input is just for testing anyway.


More information about the libav-api mailing list