mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-31 11:32:38 +00:00
jitterbuffer: make sure time never goes invalid
Since the skew can be negative, we might end up with invalid timestamps. Check for negative results and clamp to 0. See #593354
This commit is contained in:
parent
1f14f577d8
commit
e254936e34
1 changed files with 7 additions and 1 deletions
|
@ -343,7 +343,13 @@ no_skew:
|
|||
/* the output time is defined as the base timestamp plus the RTP time
|
||||
* adjusted for the clock skew .*/
|
||||
if (jbuf->base_time != -1) {
|
||||
out_time = jbuf->base_time + send_diff + jbuf->skew;
|
||||
out_time = jbuf->base_time + send_diff;
|
||||
/* skew can be negative and we don't want to make invalid timestamps */
|
||||
if (jbuf->skew < 0 && out_time < -jbuf->skew) {
|
||||
out_time = 0;
|
||||
} else {
|
||||
out_time += jbuf->skew;
|
||||
}
|
||||
/* check if timestamps are not going backwards, we can only check this if we
|
||||
* have a previous out time and a previous send_diff */
|
||||
if (G_LIKELY (jbuf->prev_out_time != -1 && jbuf->prev_send_diff != -1)) {
|
||||
|
|
Loading…
Reference in a new issue