playbin2: Reset stream segments on FLUSH_STOP and don't adjust QoS events for non-time segments

This commit is contained in:
Sebastian Dröge 2009-12-06 18:05:15 +01:00
parent 56d3856620
commit 930a57db20

View file

@ -2370,7 +2370,8 @@ _playsink_src_event_probe_cb (GstPad * pad, GstEvent * event,
return TRUE; return TRUE;
/* If we have no group start accumulator yet, this is /* If we have no group start accumulator yet, this is
* a QOS event for the previous group * a QOS event for the previous group or this stream
* has a non-time segment.
*/ */
if (!GST_CLOCK_TIME_IS_VALID (group_start_accum)) if (!GST_CLOCK_TIME_IS_VALID (group_start_accum))
return FALSE; return FALSE;
@ -2414,26 +2415,27 @@ static gboolean
_playsink_sink_event_probe_cb (GstPad * pad, GstEvent * event, _playsink_sink_event_probe_cb (GstPad * pad, GstEvent * event,
PlaySinkEventProbeData * data) PlaySinkEventProbeData * data)
{ {
guint index;
if (data->type == GST_PLAY_SINK_TYPE_VIDEO
|| data->type == GST_PLAY_SINK_TYPE_VIDEO_RAW)
index = 0;
else if (data->type == GST_PLAY_SINK_TYPE_AUDIO
|| data->type == GST_PLAY_SINK_TYPE_AUDIO_RAW)
index = 1;
else if (data->type == GST_PLAY_SINK_TYPE_TEXT)
index = 2;
else
g_assert_not_reached ();
if (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT) { if (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT) {
GstPlayBin *playbin = data->playbin; GstPlayBin *playbin = data->playbin;
GstSegment *segment; GstSegment *segment;
guint index;
gboolean update; gboolean update;
GstFormat format; GstFormat format;
gdouble rate, applied_rate; gdouble rate, applied_rate;
gint64 start, stop, pos; gint64 start, stop, pos;
if (data->type == GST_PLAY_SINK_TYPE_VIDEO
|| data->type == GST_PLAY_SINK_TYPE_VIDEO_RAW)
index = 0;
else if (data->type == GST_PLAY_SINK_TYPE_AUDIO
|| data->type == GST_PLAY_SINK_TYPE_AUDIO_RAW)
index = 1;
else if (data->type == GST_PLAY_SINK_TYPE_TEXT)
index = 2;
else
g_assert_not_reached ();
segment = &playbin->segments[index]; segment = &playbin->segments[index];
gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate, gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate,
@ -2443,9 +2445,13 @@ _playsink_sink_event_probe_cb (GstPad * pad, GstEvent * event,
gst_segment_set_newsegment_full (segment, update, rate, applied_rate, gst_segment_set_newsegment_full (segment, update, rate, applied_rate,
format, start, stop, pos); format, start, stop, pos);
if (!GST_CLOCK_TIME_IS_VALID (data->group->selector[data-> if (format != GST_FORMAT_TIME)
data->group->selector[data->type].group_start_accum = GST_CLOCK_TIME_NONE;
else if (!GST_CLOCK_TIME_IS_VALID (data->group->selector[data->
type].group_start_accum)) type].group_start_accum))
data->group->selector[data->type].group_start_accum = segment->accum; data->group->selector[data->type].group_start_accum = segment->accum;
} else if (GST_EVENT_TYPE (event) == GST_EVENT_FLUSH_STOP) {
gst_segment_init (&data->playbin->segments[index], GST_FORMAT_UNDEFINED);
} }
return TRUE; return TRUE;