[Gstavdemux] check if we ran outside of the segment

Majaja r97922153 at gmail.com
Mon Oct 10 00:31:27 UTC 2016


Dear all:

I wonder the correctness about the flow within Gstavdemux to check  if we
ran outside of the segment.

Please see the following flow.
*
  /* do timestamps, we do this first so that we can know when we
   * stepped over the segment stop position. */
  timestamp = gst_ffmpeg_time_ff_to_gst (pkt.pts, avstream->time_base);
  if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
    stream->last_ts = timestamp;
  }
  ...
  if (GST_CLOCK_TIME_IS_VALID (timestamp))
    timestamp -= demux->start_time;
  ...

  /* check if we ran outside of the segment */
  if (demux->segment.stop != -1 && timestamp > demux->segment.stop)
    goto drop;*

When we are given the settings below and it means we want to playback P1 B3
B4 only.

Presentation order =  I1 B1 B2 { P1 B3 B4 } I2
decoding      order =  I1 P1 B1 B2 I2 B3 B4

PTS of ( I1 B1 B2 P1 B3 B4  I2) = ( 1, 2, 3, 4, 5, 6, 7)
DTS of ( I1 B1 B2 P1 B3 B4  I2) = (1, 3, 4, 2, 6, 7, 5) 

The segment stop is set to "6" accordingly since the PTS of {P1 B3 B4} = (
4, 5, 6 ).

However, notice that the PTS of I2 is "7" which is larger than 6. Also we
will demux it before B3 & B4. 

By the flow : "check if we ran outside of the segment", we will go to the
drop label & pause where.

The result is we miss the following two B frames, which should be played
originally.


I think an additional check such as "if we have met the first Key frame
whose PTS is greater than segment's stop, go to drop (pause)" will be safe.


Thanks.



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Gstavdemux-check-if-we-ran-outside-of-the-segment-tp4680005.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list