[vlc-commits] aout: second guess whether the video output should be recycled

Rémi Denis-Courmont git at videolan.org
Fri Apr 26 18:02:39 CEST 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Apr 26 18:52:14 2013 +0300| [2b25517641d9db73c801f83cf47641d52035c8e9] | committer: Rémi Denis-Courmont

aout: second guess whether the video output should be recycled

This restores the brittle logic from VLC version 2.0.x (fixes #8499).
I strongly suspect there are some false positives left, which would
lead to ghost video outputs.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2b25517641d9db73c801f83cf47641d52035c8e9
---

 src/audio_output/aout_internal.h |    1 -
 src/audio_output/dec.c           |    3 +++
 src/audio_output/filters.c       |   21 ++++-----------------
 3 files changed, 7 insertions(+), 18 deletions(-)

diff --git a/src/audio_output/aout_internal.h b/src/audio_output/aout_internal.h
index 040cae4..af9613e 100644
--- a/src/audio_output/aout_internal.h
+++ b/src/audio_output/aout_internal.h
@@ -82,7 +82,6 @@ typedef struct
     audio_sample_format_t mixer_format;
 
     aout_request_vout_t request_vout;
-    bool recycle_vout;
 
     atomic_uint buffers_lost;
     atomic_uchar restart;
diff --git a/src/audio_output/dec.c b/src/audio_output/dec.c
index e5e3a43..3fd0cff 100644
--- a/src/audio_output/dec.c
+++ b/src/audio_output/dec.c
@@ -160,6 +160,9 @@ static int aout_CheckReady (audio_output_t *aout)
                 owner->mixer_format.i_format = 0;
             }
         }
+        /* TODO: This would be a good time to call clean up any video output
+         * left over by an audio visualization:
+        input_resource_TerminatVout(MAGIC HERE); */
     }
     return (owner->mixer_format.i_format) ? 0 : -1;
 }
diff --git a/src/audio_output/filters.c b/src/audio_output/filters.c
index 5cd43d5..1ceb1f1 100644
--- a/src/audio_output/filters.c
+++ b/src/audio_output/filters.c
@@ -336,11 +336,12 @@ vout_thread_t *aout_filter_RequestVout (filter_t *filter, vout_thread_t *vout,
      * If you want to use visualization filters from another place, you will
      * need to add a new pf_aout_request_vout callback or store a pointer
      * to aout_request_vout_t inside filter_t (i.e. a level of indirection). */
-    aout_owner_t *owner = aout_owner ((audio_output_t *)filter->p_parent);
     const aout_request_vout_t *req = (void *)filter->p_owner;
+    char *visual = var_InheritString (filter->p_parent, "audio-visual");
+    bool recycle = (visual != NULL) && strcasecmp(visual, "none");
+    free (visual);
 
-    return req->pf_request_vout (req->p_private, vout, fmt,
-                                 owner->recycle_vout);
+    return req->pf_request_vout (req->p_private, vout, fmt, recycle);
 }
 
 static int AppendFilter(vlc_object_t *obj, const char *type, const char *name,
@@ -398,8 +399,6 @@ aout_filters_t *aout_FiltersNew (audio_output_t *aout,
     filters->resampling = 0;
     filters->count = 0;
 
-    aout_owner_t *owner = aout_owner (aout);
-
     /* Prepare format structure */
     aout_FormatPrint (aout, "input", infmt);
     audio_sample_format_t input_format = *infmt;
@@ -446,7 +445,6 @@ aout_filters_t *aout_FiltersNew (audio_output_t *aout,
     }
 
     char *visual = var_InheritString (aout, "audio-visual");
-    owner->recycle_vout = visual != NULL;
     if (visual != NULL && strcasecmp (visual, "none"))
     {
         AppendFilter(VLC_OBJECT(aout), "visualization", visual, filters,
@@ -492,23 +490,12 @@ error:
  */
 void aout_FiltersDelete (audio_output_t *aout, aout_filters_t *filters)
 {
-    aout_owner_t *owner = aout_owner (aout);
-
     if (filters->resampler != NULL)
         aout_FiltersPipelineDestroy (&filters->resampler, 1);
     aout_FiltersPipelineDestroy (filters->tab, filters->count);
     var_DelCallback (aout, "equalizer", EqualizerCallback, NULL);
     var_DelCallback (aout, "visual", VisualizationCallback, NULL);
 
-    /* XXX We need to update recycle_vout before calling
-     * aout_FiltersPipelineDestroy().
-     * FIXME There may be a race condition if audio-visual is updated between
-     * aout_FiltersDestroy() and the next aout_FiltersNew().
-     */
-    char *visual = var_InheritString (aout, "audio-visual");
-    owner->recycle_vout = (visual != NULL) && *visual;
-    free (visual);
-
     free (filters);
 }
 



More information about the vlc-commits mailing list