[vlc-commits] [Git][videolan/vlc][master] 3 commits: pulse: get pa_timing_info once

Thomas Guillem (@tguillem) gitlab at videolan.org
Thu Sep 15 10:45:19 UTC 2022



Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
c96003ac by Thomas Guillem at 2022-09-15T09:41:26+00:00
pulse: get pa_timing_info once

And always check if valid.

- - - - -
d2b51cd9 by Thomas Guillem at 2022-09-15T09:41:26+00:00
pulse: check for write_index_corrupt

Like it was done in the previous TimeGet() (via vlc_pa_get_latency()).

- - - - -
dc40e5f3 by Thomas Guillem at 2022-09-15T09:41:26+00:00
pulse: don't report timing if paused

Fixes #27137

- - - - -


1 changed file:

- modules/audio_output/pulse.c


Changes:

=====================================
modules/audio_output/pulse.c
=====================================
@@ -310,6 +310,16 @@ static void stream_latency_cb(pa_stream *s, void *userdata)
     if (pa_stream_is_corked(s) > 0)
         stream_start(s, aout, sys->last_date);
 
+    const pa_timing_info *ti = pa_stream_get_timing_info(s);
+    if (unlikely(ti == NULL) || !ti->playing)
+        return;
+
+    if (ti->write_index_corrupt)
+    {
+        msg_Dbg(aout, "write index corrupt");
+        return;
+    }
+
     if (pa_stream_is_corked(s) == 0)
     {
         pa_usec_t rt;
@@ -319,7 +329,6 @@ static void stream_latency_cb(pa_stream *s, void *userdata)
             {
                 /* Subtract the timestamp of the timing_info from the monotonic
                  * time */
-                const pa_timing_info *ti = pa_stream_get_timing_info(s);
                 pa_usec_t ti_age_us = pa_timeval_age(&ti->timestamp);
                 vlc_tick_t system_ts = vlc_tick_now()
                                      - VLC_TICK_FROM_US(ti_age_us);
@@ -336,9 +345,7 @@ static void stream_latency_cb(pa_stream *s, void *userdata)
                  * transport_usec, sink_usec), but the current read index
                  * should always be superior or equal. */
                 const pa_sample_spec *ss = pa_stream_get_sample_spec(s);
-                const pa_timing_info *ti = pa_stream_get_timing_info(s);
-                if (ti != NULL && !ti->read_index_corrupt)
-                    assert(pa_bytes_to_usec(ti->read_index, ss) >= sys->flush_rt);
+                assert(pa_bytes_to_usec(ti->read_index, ss) >= sys->flush_rt);
             }
 #endif
         }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0773a89ed61faf9a933d4c715d2773d71e866598...dc40e5f3aee4b493e97122db8498a188764420b7

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0773a89ed61faf9a933d4c715d2773d71e866598...dc40e5f3aee4b493e97122db8498a188764420b7
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