mssdemux: fix reverse playback fragment tracking

Rework reverse fragment traversing with repetition fields to prevent
NULL pointer deref and avoid never advancing a fragment as the variable
is unsigned and would always be non-negative.

CID #1257627
CID #1257628
This commit is contained in:
Thiago Santos 2014-12-10 15:27:49 -03:00
parent 4d89d7116b
commit 8b63a16af0

View file

@ -986,16 +986,15 @@ gst_mss_stream_regress_fragment (GstMssStream * stream)
return GST_FLOW_EOS;
fragment = stream->current_fragment->data;
stream->fragment_repetition_index--;
if (stream->fragment_repetition_index >= 0) {
return GST_FLOW_OK;
if (stream->fragment_repetition_index == 0) {
stream->current_fragment = g_list_previous (stream->current_fragment);
if (stream->current_fragment == NULL)
return GST_FLOW_EOS;
fragment = stream->current_fragment->data;
stream->fragment_repetition_index = fragment->repetitions - 1;
} else {
stream->fragment_repetition_index--;
}
stream->current_fragment = g_list_previous (stream->current_fragment);
fragment = stream->current_fragment->data;
if (stream->current_fragment == NULL)
return GST_FLOW_EOS;
stream->fragment_repetition_index = fragment->repetitions - 1;
return GST_FLOW_OK;
}