[vlc-commits] [Git][videolan/vlc][master] 2 commits: coreaudio: increase timing count before checking it

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Nov 22 15:09:32 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
a55a3fd4 by Thomas Guillem at 2023-11-22T14:28:58+00:00
coreaudio: increase timing count before checking it

The latency will be reported a little earlier (by the number of frames
in a data callback).

- - - - -
045c89d5 by Thomas Guillem at 2023-11-22T14:28:58+00:00
coreaudio: don't wait 1second to report the first latency

- - - - -


1 changed file:

- modules/audio_output/coreaudio_common.c


Changes:

=====================================
modules/audio_output/coreaudio_common.c
=====================================
@@ -249,15 +249,20 @@ ca_Render(audio_output_t *p_aout, uint64_t host_time,
         }
     }
 
+    p_sys->timing_report_last_written_bytes += bytes_copied;
+
     if (p_sys->timing_report_last_written_bytes >=
         p_sys->timing_report_delay_bytes)
     {
         p_sys->timing_report_last_written_bytes = 0;
+
+        /* From now on, fetch the timestamp every 1 seconds */
+        p_sys->timing_report_delay_bytes =
+            TicksToBytes(p_sys, TIMING_REPORT_DELAY_TICKS);
+
         vlc_tick_t pos_ticks = BytesToTicks(p_sys, p_sys->i_total_bytes);
         aout_TimingReport(p_aout, end_ticks + GetLatency(p_aout), pos_ticks);
     }
-    else
-        p_sys->timing_report_last_written_bytes += bytes_copied;
 
     lock_unlock(p_sys);
 }
@@ -274,6 +279,7 @@ ca_Flush(audio_output_t *p_aout)
     p_sys->i_out_size = 0;
     p_sys->i_total_bytes = 0;
     p_sys->first_play_date = VLC_TICK_INVALID;
+    p_sys->timing_report_delay_bytes =
     p_sys->timing_report_last_written_bytes = 0;
 
     ca_ClearOutBuffers(p_aout);
@@ -360,7 +366,6 @@ ca_Initialize(audio_output_t *p_aout, const audio_sample_format_t *fmt,
     p_sys->i_out_size = 0;
     p_sys->i_total_bytes = 0;
     p_sys->first_play_date = VLC_TICK_INVALID;
-    p_sys->timing_report_last_written_bytes = 0;
 
     p_sys->i_rate = fmt->i_rate;
     p_sys->i_bytes_per_frame = fmt->i_bytes_per_frame;
@@ -370,7 +375,8 @@ ca_Initialize(audio_output_t *p_aout, const audio_sample_format_t *fmt,
         p_sys->get_latency = get_latency;
     else
         p_sys->i_dev_latency_ticks = i_dev_latency_ticks;
-    p_sys->timing_report_delay_bytes = TicksToBytes(p_sys, TIMING_REPORT_DELAY_TICKS);
+    p_sys->timing_report_delay_bytes =
+    p_sys->timing_report_last_written_bytes = 0;
 
     ca_ClearOutBuffers(p_aout);
     p_sys->b_played = false;
@@ -402,7 +408,7 @@ void ca_ResetDeviceLatency(audio_output_t *p_aout)
 
     lock_lock(p_sys);
     /* Trigger aout_TimingReport() to be called from the next render callback */
-    p_sys->timing_report_last_written_bytes = p_sys->timing_report_delay_bytes;
+    p_sys->timing_report_delay_bytes = 0;
     lock_unlock(p_sys);
 }
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/ff44904b5a74c71d59efc3d7cc38fd2a1985f920...045c89d5d83a22182879579ad36b885fad6d556c

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/ff44904b5a74c71d59efc3d7cc38fd2a1985f920...045c89d5d83a22182879579ad36b885fad6d556c
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