Modestas, in DecoderPlayAudio(), your modified decoder.c patch fails to unlock the mutex when the loop exits on !p_audio. On my system, this causes vlc to become unresponsive when a video ends.
I looked in to 557eaa06 and 5b2de769 as suggested by Rémi, but since they depend on many other commits and don't appear necessary in my own testing, I abandoned the effort. I'm attaching my current patches for review. One is adapted from git commit 6ae2905e, while the other is copied verbatim from 47f74a83. As far as I can tell, they fix the stuttering bug in vlc 2.2.2 and 2.2.4, without causing new problems.
X-Git-Url: https://git.videolan.org/?p=vlc.git;a=blobdiff_plain;f=src%2Finput%2Fdecoder.c;h=fe3cd428c65c18bfbdadb55baf11521afdc2bfc7;hp=83aa5bf54e2c29ad93fae803117558e4fcd0f658;hb=6ae2905ef7fbc7de3a3a4a1bdf8ad6df46ce570a;hpb=5b2de76965ee8b1ab5e3257f8b6d71bbb4e9e3f9 --- a/src/input/decoder.c +++ b/src/input/decoder.c @@ -1162,7 +1162,10 @@ b_paused = p_owner->b_paused; if (!p_audio) + { + vlc_mutex_unlock( &p_owner->lock ); break; + } /* */ int i_rate = INPUT_RATE_DEFAULT; @@ -1180,6 +1183,9 @@ if( unlikely(p_owner->b_paused != b_paused) ) continue; /* race with input thread? retry... */ + + vlc_mutex_unlock( &p_owner->lock ); + if( p_aout == NULL ) b_reject = true; @@ -1199,7 +1205,6 @@ break; } - vlc_mutex_unlock( &p_owner->lock ); } static void DecoderDecodeAudio( decoder_t *p_dec, block_t *p_block ) @@ -1961,11 +1966,10 @@ /* Parameters changed, restart the aout */ vlc_mutex_lock( &p_owner->lock ); - - aout_DecDelete( p_owner->p_aout ); p_owner->p_aout = NULL; - vlc_mutex_unlock( &p_owner->lock ); + aout_DecDelete( p_owner->p_aout ); + input_resource_PutAout( p_owner->p_resource, p_aout ); }
X-Git-Url: https://git.videolan.org/?p=vlc.git;a=blobdiff_plain;f=modules%2Faudio_output%2Falsa.c;h=4e9fd53592d048baa8b57f30df15ab5806139d07;hp=2d1f99e9cb743bca12c6bdf32cc84a92d07fda8b;hb=47f74a83c161173b0d15e95dab8ceb7c97de51b4;hpb=6ae2905ef7fbc7de3a3a4a1bdf8ad6df46ce570a diff --git a/modules/audio_output/alsa.c b/modules/audio_output/alsa.c index 2d1f99e..4e9fd53 100644 --- a/modules/audio_output/alsa.c +++ b/modules/audio_output/alsa.c @@ -495,6 +495,15 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt) } sys->rate = fmt->i_rate; +#if 1 /* work-around for period-long latency outputs (e.g. PulseAudio): */ + param = AOUT_MIN_PREPARE_TIME; + val = snd_pcm_hw_params_set_period_time_near (pcm, hw, ¶m, NULL); + if (val) + { + msg_Err (aout, "cannot set period: %s", snd_strerror (val)); + goto error; + } +#endif /* Set buffer size */ param = AOUT_MAX_ADVANCE_TIME; val = snd_pcm_hw_params_set_buffer_time_near (pcm, hw, ¶m, NULL); @@ -503,14 +512,22 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt) msg_Err (aout, "cannot set buffer duration: %s", snd_strerror (val)); goto error; } - - param = AOUT_MIN_PREPARE_TIME; +#if 0 + val = snd_pcm_hw_params_get_buffer_time (hw, ¶m, NULL); + if (val) + { + msg_Warn (aout, "cannot get buffer time: %s", snd_strerror(val)); + param = AOUT_MIN_PREPARE_TIME; + } + else + param /= 2; val = snd_pcm_hw_params_set_period_time_near (pcm, hw, ¶m, NULL); if (val) { msg_Err (aout, "cannot set period: %s", snd_strerror (val)); goto error; } +#endif /* Commit hardware parameters */ val = snd_pcm_hw_params (pcm, hw);