dashdemux: remove unnecessary variable

Instead of using 2 indexes that were actually the same, use only
one. Saves a variable.
This commit is contained in:
Thiago Santos 2014-01-09 09:13:48 -03:00
parent cea909b877
commit 3d2f3bcf62

View file

@ -3394,18 +3394,17 @@ gboolean
gst_mpd_client_stream_seek (GstMpdClient * client, GstActiveStream * stream, gst_mpd_client_stream_seek (GstMpdClient * client, GstActiveStream * stream,
GstClockTime ts) GstClockTime ts)
{ {
gint segment_idx = 0; gint index = 0;
GstMediaSegment *selectedChunk = NULL; GstMediaSegment *selectedChunk = NULL;
gint i;
g_return_val_if_fail (stream != NULL, 0); g_return_val_if_fail (stream != NULL, 0);
GST_MPD_CLIENT_LOCK (client); GST_MPD_CLIENT_LOCK (client);
if (stream->segments) { if (stream->segments) {
for (i = 0; i < stream->segments->len; i++, segment_idx++) { for (index = 0; index < stream->segments->len; index++) {
GstMediaSegment *segment = g_ptr_array_index (stream->segments, i); GstMediaSegment *segment = g_ptr_array_index (stream->segments, index);
GST_DEBUG ("Looking at fragment sequence chunk %d", segment_idx); GST_DEBUG ("Looking at fragment sequence chunk %d", index);
if (segment->start_time <= ts if (segment->start_time <= ts
&& ts < segment->start_time + segment->duration) { && ts < segment->start_time + segment->duration) {
selectedChunk = segment; selectedChunk = segment;
@ -3420,16 +3419,16 @@ gst_mpd_client_stream_seek (GstMpdClient * client, GstActiveStream * stream,
} else { } else {
GstClockTime duration = GstClockTime duration =
gst_mpd_client_get_segment_duration (client, stream); gst_mpd_client_get_segment_duration (client, stream);
g_return_val_if_fail (stream->cur_seg_template-> g_return_val_if_fail (stream->cur_seg_template->MultSegBaseType->
MultSegBaseType->SegmentTimeline == NULL, FALSE); SegmentTimeline == NULL, FALSE);
if (!GST_CLOCK_TIME_IS_VALID (duration)) { if (!GST_CLOCK_TIME_IS_VALID (duration)) {
GST_MPD_CLIENT_UNLOCK (client); GST_MPD_CLIENT_UNLOCK (client);
return FALSE; return FALSE;
} }
segment_idx = ts / duration; index = ts / duration;
} }
gst_mpd_client_set_segment_index (stream, segment_idx); gst_mpd_client_set_segment_index (stream, index);
GST_MPD_CLIENT_UNLOCK (client); GST_MPD_CLIENT_UNLOCK (client);