Commit 125988f8 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

aout: deal with failure to restart

Drop audio rather than abort.
parent c32e21fc
...@@ -123,30 +123,28 @@ void aout_DecDelete (audio_output_t *p_aout) ...@@ -123,30 +123,28 @@ void aout_DecDelete (audio_output_t *p_aout)
#define AOUT_RESTART_OUTPUT 1 #define AOUT_RESTART_OUTPUT 1
#define AOUT_RESTART_INPUT 2 #define AOUT_RESTART_INPUT 2
static int aout_CheckRestart (audio_output_t *aout) static int aout_CheckReady (audio_output_t *aout)
{ {
aout_owner_t *owner = aout_owner (aout); aout_owner_t *owner = aout_owner (aout);
aout_assert_locked (aout); aout_assert_locked (aout);
int restart = vlc_atomic_swap (&owner->restart, 0); int restart = vlc_atomic_swap (&owner->restart, 0);
if (likely(restart == 0)) if (unlikely(restart))
return 0; {
assert (restart & AOUT_RESTART_INPUT); assert (restart & AOUT_RESTART_INPUT);
const aout_request_vout_t request_vout = owner->request_vout; const aout_request_vout_t request_vout = owner->request_vout;
aout_FiltersDelete (aout); aout_FiltersDelete (aout);
/* Reinitializes the output */
if (restart & AOUT_RESTART_OUTPUT) if (restart & AOUT_RESTART_OUTPUT)
{ { /* Reinitializes the output */
aout_OutputDelete (aout); aout_OutputDelete (aout);
owner->mixer_format = owner->input_format; owner->mixer_format = owner->input_format;
if (aout_OutputNew (aout, &owner->mixer_format)) if (aout_OutputNew (aout, &owner->mixer_format))
abort (); /* FIXME we are officially screwed */ owner->mixer_format.i_format = 0;
aout_volume_SetFormat (owner->volume, owner->mixer_format.i_format); aout_volume_SetFormat (owner->volume,
owner->mixer_format.i_format);
} }
owner->sync.end = VLC_TS_INVALID; owner->sync.end = VLC_TS_INVALID;
...@@ -155,9 +153,11 @@ static int aout_CheckRestart (audio_output_t *aout) ...@@ -155,9 +153,11 @@ static int aout_CheckRestart (audio_output_t *aout)
if (aout_FiltersNew (aout, &owner->input_format, &owner->mixer_format, if (aout_FiltersNew (aout, &owner->input_format, &owner->mixer_format,
&request_vout)) &request_vout))
{ {
abort (); /* FIXME */ aout_OutputDelete (aout);
owner->mixer_format.i_format = 0;
} }
return 0; }
return (owner->mixer_format.i_format) ? 0 : -1;
} }
/** /**
...@@ -393,7 +393,7 @@ int aout_DecPlay (audio_output_t *aout, block_t *block, int input_rate) ...@@ -393,7 +393,7 @@ int aout_DecPlay (audio_output_t *aout, block_t *block, int input_rate)
/ owner->input_format.i_rate; / owner->input_format.i_rate;
aout_lock (aout); aout_lock (aout);
if (unlikely(aout_CheckRestart (aout))) if (unlikely(aout_CheckReady (aout)))
goto drop; /* Pipeline is unrecoverably broken :-( */ goto drop; /* Pipeline is unrecoverably broken :-( */
const mtime_t now = mdate (), advance = block->i_pts - now; const mtime_t now = mdate (), advance = block->i_pts - now;
......
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