[vlc-commits] [Git][videolan/vlc][master] 2 commits: aout: hide destroy

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Tue Mar 29 19:10:59 UTC 2022



Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
53f79f01 by Thomas Guillem at 2022-03-29T17:54:51+00:00
aout: hide destroy

All aout users can trigger a destroy, when releasing, if the refcount
reaches 0.

This will allow having more than one aout users (stream from decoder.c),
for gapless and later for multiple streams playback. Indeed, you prefer
not to destroy the aout from one decoder, while used by another decoder.

- - - - -
a6d4b816 by Thomas Guillem at 2022-03-29T17:54:51+00:00
aout: move code in aout_Destroy

- - - - -


3 changed files:

- src/audio_output/aout_internal.h
- src/audio_output/output.c
- src/input/resource.c


Changes:

=====================================
src/audio_output/aout_internal.h
=====================================
@@ -106,7 +106,6 @@ void aout_volume_Delete(aout_volume_t *);
 /* From output.c : */
 audio_output_t *aout_New (vlc_object_t *);
 #define aout_New(a) aout_New(VLC_OBJECT(a))
-void aout_Destroy (audio_output_t *);
 
 int aout_OutputNew(audio_output_t *aout, vlc_aout_stream *stream,
                    audio_sample_format_t *fmt, int input_profile,


=====================================
src/audio_output/output.c
=====================================
@@ -397,7 +397,7 @@ audio_output_t *aout_Hold(audio_output_t *aout)
 /**
  * Deinitializes an audio output module and destroys an audio output object.
  */
-void aout_Destroy (audio_output_t *aout)
+static void aout_Destroy (audio_output_t *aout)
 {
     aout_owner_t *owner = aout_owner (aout);
 
@@ -418,15 +418,6 @@ void aout_Destroy (audio_output_t *aout)
     var_DelCallback(aout, "volume", var_Copy, vlc_object_parent(aout));
     var_DelCallback (aout, "stereo-mode", StereoModeCallback, NULL);
     var_DelCallback (aout, "mix-mode", MixModeCallback, NULL);
-    aout_Release(aout);
-}
-
-void aout_Release(audio_output_t *aout)
-{
-    aout_owner_t *owner = aout_owner(aout);
-
-    if (!vlc_atomic_rc_dec(&owner->rc))
-        return;
 
     aout_dev_t *dev;
     vlc_list_foreach(dev, &owner->dev.list, node)
@@ -439,6 +430,16 @@ void aout_Release(audio_output_t *aout)
     vlc_object_delete(VLC_OBJECT(aout));
 }
 
+void aout_Release(audio_output_t *aout)
+{
+    aout_owner_t *owner = aout_owner(aout);
+
+    if (!vlc_atomic_rc_dec(&owner->rc))
+        return;
+
+    aout_Destroy(aout);
+}
+
 static int aout_PrepareStereoMode(audio_output_t *aout,
                                   const audio_sample_format_t *restrict fmt)
 {


=====================================
src/input/resource.c
=====================================
@@ -272,7 +272,7 @@ void input_resource_PutAout( input_resource_t *p_resource,
     vlc_mutex_unlock( &p_resource->lock_hold );
 
     if( p_aout != NULL )
-        aout_Destroy( p_aout );
+        aout_Release( p_aout );
 }
 
 audio_output_t *input_resource_HoldAout( input_resource_t *p_resource )
@@ -301,7 +301,7 @@ void input_resource_ResetAout( input_resource_t *p_resource )
     vlc_mutex_unlock( &p_resource->lock_hold );
 
     if( p_aout != NULL )
-        aout_Destroy( p_aout );
+        aout_Release( p_aout );
 }
 
 /* Common */
@@ -335,7 +335,7 @@ void input_resource_Release( input_resource_t *p_resource )
     DestroySout( p_resource );
     DestroyVout( p_resource );
     if( p_resource->p_aout != NULL )
-        aout_Destroy( p_resource->p_aout );
+        aout_Release( p_resource->p_aout );
 
     vout_Release( p_resource->p_vout_dummy );
     free( p_resource );



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3f314c04fa15af2c5bde3b5375555865423942eb...a6d4b8165776b55c1fa685ea5cc81bc6d07dfc32

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3f314c04fa15af2c5bde3b5375555865423942eb...a6d4b8165776b55c1fa685ea5cc81bc6d07dfc32
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