[Gstavdemux] check if we ran outside of the segment

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Gstavdemux] check if we ran outside of the segment

Majaja
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.
Reply | Threaded
Open this post in threaded view
|

Re: [Gstavdemux] check if we ran outside of the segment

Sebastian Dröge-3
On Sun, 2016-10-09 at 17:31 -0700, Majaja wrote:

> 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.
Can you file a bug with a patch for discussion at
  https://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer
?

Thanks!

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (985 bytes) Download Attachment