mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-08 21:28:45 +00:00
gst/qtdemux/qtdemux.c: Store duration in uint64 too instead of clipping.
Original commit message from CVS: * gst/qtdemux/qtdemux.c: (gst_qtdemux_perform_seek), (gst_qtdemux_prepare_current_sample), (gst_qtdemux_loop_state_movie): Store duration in uint64 too instead of clipping. When we do a keyframe seek and the requested time is at the keyframe, don't seek back to the beginning of the keyframe. Fixes #347439.
This commit is contained in:
parent
cc350794fb
commit
ae5b12066b
1 changed files with 33 additions and 24 deletions
|
@ -79,7 +79,7 @@ struct _QtDemuxSample
|
||||||
guint32 size;
|
guint32 size;
|
||||||
guint64 offset;
|
guint64 offset;
|
||||||
guint64 timestamp; /* In GstClockTime */
|
guint64 timestamp; /* In GstClockTime */
|
||||||
guint32 duration; /* in GstClockTime */
|
guint64 duration; /* in GstClockTime */
|
||||||
gboolean keyframe; /* TRUE when this packet is a keyframe */
|
gboolean keyframe; /* TRUE when this packet is a keyframe */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ struct _QtDemuxStream
|
||||||
guint32 n_samples;
|
guint32 n_samples;
|
||||||
QtDemuxSample *samples;
|
QtDemuxSample *samples;
|
||||||
gboolean all_keyframe; /* TRUE when all samples are keyframes (no stss) */
|
gboolean all_keyframe; /* TRUE when all samples are keyframes (no stss) */
|
||||||
guint32 min_duration; /* duration of dirst sample, used for figuring out
|
guint32 min_duration; /* duration in timescale of dirst sample, used for figuring out
|
||||||
the framerate, in timescale units */
|
the framerate, in timescale units */
|
||||||
|
|
||||||
/* if we use chunks or samples */
|
/* if we use chunks or samples */
|
||||||
|
@ -659,7 +659,7 @@ gst_qtdemux_perform_seek (GstQTDemux * qtdemux, GstSegment * segment)
|
||||||
* and move back to the previous keyframe. */
|
* and move back to the previous keyframe. */
|
||||||
for (n = 0; n < qtdemux->n_streams; n++) {
|
for (n = 0; n < qtdemux->n_streams; n++) {
|
||||||
QtDemuxStream *str;
|
QtDemuxStream *str;
|
||||||
guint32 index;
|
guint32 index, kindex;
|
||||||
guint32 seg_idx;
|
guint32 seg_idx;
|
||||||
guint64 media_start;
|
guint64 media_start;
|
||||||
guint64 media_time;
|
guint64 media_time;
|
||||||
|
@ -686,13 +686,21 @@ gst_qtdemux_perform_seek (GstQTDemux * qtdemux, GstSegment * segment)
|
||||||
index = gst_qtdemux_find_index (qtdemux, str, media_start);
|
index = gst_qtdemux_find_index (qtdemux, str, media_start);
|
||||||
GST_DEBUG_OBJECT (qtdemux, "sample for %" GST_TIME_FORMAT " at %u",
|
GST_DEBUG_OBJECT (qtdemux, "sample for %" GST_TIME_FORMAT " at %u",
|
||||||
GST_TIME_ARGS (media_start), index);
|
GST_TIME_ARGS (media_start), index);
|
||||||
/* find previous keyframe */
|
|
||||||
index = gst_qtdemux_find_keyframe (qtdemux, str, index);
|
|
||||||
/* get timestamp of keyframe */
|
|
||||||
media_time = str->samples[index].timestamp;
|
|
||||||
|
|
||||||
|
/* find previous keyframe */
|
||||||
|
kindex = gst_qtdemux_find_keyframe (qtdemux, str, index);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (qtdemux, "keyframe at %u", kindex);
|
||||||
|
|
||||||
|
/* if the keyframe is at a different position, we need to update the
|
||||||
|
* requiested seek time */
|
||||||
|
if (index != kindex) {
|
||||||
|
index = kindex;
|
||||||
|
|
||||||
|
/* get timestamp of keyframe */
|
||||||
|
media_time = str->samples[kindex].timestamp;
|
||||||
GST_DEBUG_OBJECT (qtdemux, "keyframe at %u with time %" GST_TIME_FORMAT,
|
GST_DEBUG_OBJECT (qtdemux, "keyframe at %u with time %" GST_TIME_FORMAT,
|
||||||
index, GST_TIME_ARGS (media_time));
|
kindex, GST_TIME_ARGS (media_time));
|
||||||
|
|
||||||
/* keyframes in the segment get a chance to change the
|
/* keyframes in the segment get a chance to change the
|
||||||
* desired_offset. keyframes out of the segment are
|
* desired_offset. keyframes out of the segment are
|
||||||
|
@ -707,10 +715,10 @@ gst_qtdemux_perform_seek (GstQTDemux * qtdemux, GstSegment * segment)
|
||||||
min_offset = seg_time;
|
min_offset = seg_time;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
desired_offset = min_offset;
|
}
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (qtdemux, "keyframe seek, align to %"
|
GST_DEBUG_OBJECT (qtdemux, "keyframe seek, align to %"
|
||||||
GST_TIME_FORMAT, GST_TIME_ARGS (desired_offset));
|
GST_TIME_FORMAT, GST_TIME_ARGS (desired_offset));
|
||||||
|
desired_offset = min_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* and set all streams to the final position */
|
/* and set all streams to the final position */
|
||||||
|
@ -1134,7 +1142,7 @@ gst_qtdemux_activate_segment (GstQTDemux * qtdemux, QtDemuxStream * stream,
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_qtdemux_prepare_current_sample (GstQTDemux * qtdemux,
|
gst_qtdemux_prepare_current_sample (GstQTDemux * qtdemux,
|
||||||
QtDemuxStream * stream, guint64 * offset, guint * size, guint64 * timestamp,
|
QtDemuxStream * stream, guint64 * offset, guint * size, guint64 * timestamp,
|
||||||
guint32 * duration, gboolean * keyframe)
|
guint64 * duration, gboolean * keyframe)
|
||||||
{
|
{
|
||||||
QtDemuxSample *sample;
|
QtDemuxSample *sample;
|
||||||
guint64 time_position;
|
guint64 time_position;
|
||||||
|
@ -1283,7 +1291,7 @@ gst_qtdemux_loop_state_movie (GstQTDemux * qtdemux)
|
||||||
guint64 min_time;
|
guint64 min_time;
|
||||||
guint64 offset;
|
guint64 offset;
|
||||||
guint64 timestamp;
|
guint64 timestamp;
|
||||||
guint32 duration;
|
guint64 duration;
|
||||||
gboolean keyframe;
|
gboolean keyframe;
|
||||||
guint size;
|
guint size;
|
||||||
gint index;
|
gint index;
|
||||||
|
@ -1354,8 +1362,9 @@ gst_qtdemux_loop_state_movie (GstQTDemux * qtdemux)
|
||||||
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
|
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
|
||||||
|
|
||||||
GST_LOG_OBJECT (qtdemux,
|
GST_LOG_OBJECT (qtdemux,
|
||||||
"Pushing buffer with time %" GST_TIME_FORMAT " on pad %p",
|
"Pushing buffer with time %" GST_TIME_FORMAT ", duration %"
|
||||||
GST_TIME_ARGS (timestamp), stream->pad);
|
GST_TIME_FORMAT " on pad %p", GST_TIME_ARGS (timestamp),
|
||||||
|
GST_TIME_ARGS (duration), stream->pad);
|
||||||
|
|
||||||
gst_buffer_set_caps (buf, stream->caps);
|
gst_buffer_set_caps (buf, stream->caps);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue