Commit 2b255176 authored by Rémi Denis-Courmont's avatar 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.
parent e7c8efb8
......@@ -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;
......
......@@ -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;
}
......
......@@ -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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment