mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 14:06:23 +00:00
hlsdemux2/m3u8: use GstClockTimeDiff to do timestamp comparison
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5234>
This commit is contained in:
parent
5051a34318
commit
aa68b5e02a
1 changed files with 5 additions and 5 deletions
|
@ -1377,7 +1377,7 @@ gst_hls_media_playlist_seek (GstHLSMediaPlaylist * playlist, gboolean forward,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (part->stream_time <= ts
|
} else if (part->stream_time <= ts
|
||||||
&& ts < part->stream_time + part->duration) {
|
&& ts < (GstClockTimeDiff) (part->stream_time + part->duration)) {
|
||||||
res = cand;
|
res = cand;
|
||||||
if (!want_keyunit || part->independent)
|
if (!want_keyunit || part->independent)
|
||||||
res_part_idx = part_idx;
|
res_part_idx = part_idx;
|
||||||
|
@ -1413,7 +1413,7 @@ gst_hls_media_playlist_seek (GstHLSMediaPlaylist * playlist, gboolean forward,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
} else if ((cand->stream_time <= ts || idx == 0)
|
} else if ((cand->stream_time <= ts || idx == 0)
|
||||||
&& ts < cand->stream_time + cand->duration) {
|
&& ts < (GstClockTimeDiff) (cand->stream_time + cand->duration)) {
|
||||||
res = cand;
|
res = cand;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -1477,8 +1477,8 @@ gst_hls_media_playlist_find_partial_position (GstHLSMediaPlaylist * playlist,
|
||||||
|
|
||||||
/* If the target timestamp is before this partial segment, or in the first half, this
|
/* If the target timestamp is before this partial segment, or in the first half, this
|
||||||
* is the partial segment to land in */
|
* is the partial segment to land in */
|
||||||
if (cand->stream_time + (cand->duration / 2) >= ts &&
|
if ((GstClockTimeDiff) (cand->stream_time + (cand->duration / 2)) >= ts &&
|
||||||
cand->stream_time <= ts + (cand->duration / 2)) {
|
cand->stream_time <= (GstClockTimeDiff) (ts + (cand->duration / 2))) {
|
||||||
GST_DEBUG ("choosing partial segment %d", part_idx);
|
GST_DEBUG ("choosing partial segment %d", part_idx);
|
||||||
seek_result->segment = gst_m3u8_media_segment_ref (seg);
|
seek_result->segment = gst_m3u8_media_segment_ref (seg);
|
||||||
seek_result->found_partial_segment = TRUE;
|
seek_result->found_partial_segment = TRUE;
|
||||||
|
@ -1537,7 +1537,7 @@ gst_hls_media_playlist_find_position (GstHLSMediaPlaylist * playlist,
|
||||||
/* If the target stream time is definitely past the end
|
/* If the target stream time is definitely past the end
|
||||||
* of this segment, no earlier segment (with lower stream time)
|
* of this segment, no earlier segment (with lower stream time)
|
||||||
* could match, so we fail */
|
* could match, so we fail */
|
||||||
if (ts >= cand->stream_time + (3 * cand->duration / 2)) {
|
if (ts >= (GstClockTimeDiff) (cand->stream_time + (3 * cand->duration / 2))) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue