Ignore duration changes below 1ms during playback

This commit is contained in:
Rafał Dzięgiel
2021-04-27 10:43:13 +02:00
parent 997e47b93c
commit 3238270c0d
2 changed files with 3 additions and 7 deletions

View File

@@ -1575,7 +1575,8 @@ duration_changed_signal_data_free (DurationChangedSignalData * data)
static void
emit_duration_changed (GstClapper * self, GstClockTime duration)
{
if (self->cached_duration == duration)
if (self->cached_duration == duration
|| self->cached_duration / GST_MSECOND == duration / GST_MSECOND)
return;
GST_DEBUG_OBJECT (self, "Duration changed %" GST_TIME_FORMAT,

View File

@@ -454,14 +454,9 @@ class ClapperWidget extends Gtk.Grid
const durationSeconds = duration / Gst.SECOND;
const durationFloor = Math.floor(durationSeconds);
/* Sometimes GstPlayer might re-emit
* duration changed during playback */
if(this.controls.currentDuration === durationFloor)
return;
debug(`duration changed: ${durationSeconds}`);
this.controls.currentDuration = durationFloor;
this.controls.showHours = (durationFloor >= 3600);
this.controls.positionAdjustment.set_upper(durationFloor);
this.controls.durationFormatted = Misc.getFormattedTime(durationFloor);
this.controls.updateElapsedLabel();