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


Commits:
d7b23375 by Rémi Denis-Courmont at 2022-06-06T12:53:27+00:00
configure: require PulseAudio 6.0

This is needed in the next commit.

- - - - -
7a91ac6c by Rémi Denis-Courmont at 2022-06-06T12:53:27+00:00
pulse: use pa_stream_write_ext_free()

This simplifies and cleans up the buffer passing.

- - - - -


2 changed files:

- configure.ac
- modules/audio_output/pulse.c


Changes:

=====================================
configure.ac
=====================================
@@ -3604,11 +3604,11 @@ AC_ARG_ENABLE([pulse],
     [use the PulseAudio client library (default auto)]))
 have_pulse="no"
 AS_IF([test "${enable_pulse}" != "no"], [
-  PKG_CHECK_MODULES([PULSE], [libpulse >= 1.0], [
+  PKG_CHECK_MODULES([PULSE], [libpulse >= 6.0], [
     have_pulse="yes"
   ], [
     AS_IF([test "x${enable_pulse}" != "x"], [
-      AC_MSG_ERROR([$PULSE_PKG_ERRORS. PulseAudio 1.0 or later required.])
+      AC_MSG_ERROR([$PULSE_PKG_ERRORS. PulseAudio 6.0 or later required.])
     ])
   ])
 ])


=====================================
modules/audio_output/pulse.c
=====================================
@@ -494,28 +494,9 @@ static int TimeGet(audio_output_t *aout, vlc_tick_t 
*restrict delay)
     return ret;
 }
 
-/* Memory free callback. The block_t address is in front of the data. */
 static void data_free(void *data)
 {
-    block_t **pp = data, *block;
-
-    memcpy(&block, pp - 1, sizeof (block));
-    block_Release(block);
-}
-
-static void *data_convert(block_t **pp)
-{
-    block_t *block = *pp;
-    /* In most cases, there is enough head room, and this is really cheap: */
-    block = block_Realloc(block, sizeof (block), block->i_buffer);
-    *pp = block;
-    if (unlikely(block == NULL))
-        return NULL;
-
-    memcpy(block->p_buffer, &block, sizeof (block));
-    block->p_buffer += sizeof (block);
-    block->i_buffer -= sizeof (block);
-    return block->p_buffer;
+    block_Release(data);
 }
 
 /**
@@ -526,12 +507,6 @@ static void Play(audio_output_t *aout, block_t *block, 
vlc_tick_t date)
     aout_sys_t *sys = aout->sys;
     pa_stream *s = sys->stream;
 
-    const void *ptr = data_convert(&block);
-    if (unlikely(ptr == NULL))
-        return;
-
-    size_t len = block->i_buffer;
-
     /* Note: The core already holds the output FIFO lock at this point.
      * Therefore we must not under any circumstances (try to) acquire the
      * output FIFO lock while the PulseAudio threaded main loop lock is held
@@ -552,7 +527,8 @@ static void Play(audio_output_t *aout, block_t *block, 
vlc_tick_t date)
     }
 #endif
 
-    if (pa_stream_write(s, ptr, len, data_free, 0, PA_SEEK_RELATIVE) < 0) {
+    if (pa_stream_write_ext_free(s, block->p_buffer, block->i_buffer,
+                                 data_free, block, 0, PA_SEEK_RELATIVE) < 0) {
         vlc_pa_error(aout, "cannot write", sys->context);
         block_Release(block);
     }



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/b4d191ddbcaa7031547dcabad2fe589e35defc12...7a91ac6c3a010243ee1ea1987c7d7a40b569fb5b

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/b4d191ddbcaa7031547dcabad2fe589e35defc12...7a91ac6c3a010243ee1ea1987c7d7a40b569fb5b
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance
_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to