[vlc-commits] [Git][videolan/vlc][master] 2 commits: clock: avg: add AvgResetAndFill

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Jun 4 10:35:18 UTC 2022



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
3295489b by Thomas Guillem at 2022-06-04T10:16:40+00:00
clock: avg: add AvgResetAndFill

Refs #27023

- - - - -
6144634a by Thomas Guillem at 2022-06-04T10:16:40+00:00
clock: fill coeff_avg with the initial rate

In order to solve bad convergence of the initial jitter.

This will soften the aout->time_get imprecision at the beginning.

Thanks Denis Charmet for the idea.

Ref #27023

- - - - -


3 changed files:

- src/clock/clock.c
- src/clock/clock_internal.c
- src/clock/clock_internal.h


Changes:

=====================================
src/clock/clock.c
=====================================
@@ -91,9 +91,9 @@ static vlc_tick_t main_stream_to_system(vlc_clock_main_t *main_clock,
 
 static void vlc_clock_main_reset(vlc_clock_main_t *main_clock)
 {
-    AvgReset(&main_clock->coeff_avg);
     main_clock->coeff = 1.0f;
     main_clock->rate = 1.0f;
+    AvgResetAndFill(&main_clock->coeff_avg, main_clock->coeff);
     main_clock->offset = VLC_TICK_INVALID;
 
     main_clock->wait_sync_ref_priority = UINT_MAX;
@@ -429,6 +429,7 @@ vlc_clock_main_t *vlc_clock_main_New(struct vlc_logger *parent_logger, struct vl
     main_clock->output_dejitter = AOUT_MAX_PTS_ADVANCE * 2;
 
     AvgInit(&main_clock->coeff_avg, 10);
+    AvgResetAndFill(&main_clock->coeff_avg, main_clock->coeff);
 
     return main_clock;
 }


=====================================
src/clock/clock_internal.c
=====================================
@@ -47,6 +47,12 @@ void AvgReset(average_t *avg)
     avg->count = 0;
 }
 
+void AvgResetAndFill(average_t *avg, double value)
+{
+    avg->value = value;
+    avg->count = avg->range;
+}
+
 void AvgUpdate(average_t *avg, double value)
 {
     const int new_value_weight = 1;


=====================================
src/clock/clock_internal.h
=====================================
@@ -47,6 +47,7 @@ void AvgInit(average_t *, int range);
 void AvgClean(average_t *);
 
 void AvgReset(average_t *);
+void AvgResetAndFill(average_t *, double value);
 
 /*  calculates (previous_average * (range - 1) + new_value)/range */
 void AvgUpdate(average_t *, double value);
@@ -66,4 +67,4 @@ static inline clock_point_t clock_point_Create(vlc_tick_t system, vlc_tick_t str
     return (clock_point_t) { .system = system, .stream = stream };
 }
 
-#endif
\ No newline at end of file
+#endif



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/744efb1b51497d8a760bf9f05d9ffd8d4c6c5e60...6144634a178f6e876b7dd301e357b6b0bcaa1862

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/744efb1b51497d8a760bf9f05d9ffd8d4c6c5e60...6144634a178f6e876b7dd301e357b6b0bcaa1862
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list