[vlc-commits] [Git][videolan/vlc][master] 2 commits: aaudio: handle flush/close error
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Sat Aug 16 08:27:35 UTC 2025
Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
780bd584 by Thomas Guillem at 2025-08-16T08:12:10+00:00
aaudio: handle flush/close error
Fix stream not restarted in case of error (don't wait for the correct state).
- - - - -
6df8b9ec by Thomas Guillem at 2025-08-16T08:12:10+00:00
aaudio: fix drain when not started
if first_play_date is valid, then the stream is started. Otherwise,
there is nothing to drain.
- - - - -
1 changed file:
- modules/audio_output/android/aaudio.c
Changes:
=====================================
modules/audio_output/android/aaudio.c
=====================================
@@ -501,14 +501,18 @@ CloseAAudioStream(aout_stream_t *stream)
{
struct sys *sys = stream->sys;
- RequestStop(stream);
+ if (!sys->error)
+ {
+ RequestStop(stream);
- if (WaitState(stream, AAUDIO_STREAM_STATE_STOPPED) != VLC_SUCCESS)
- msg_Warn(stream, "Error waiting for stopped state");
+ if (WaitState(stream, AAUDIO_STREAM_STATE_STOPPED) != VLC_SUCCESS)
+ msg_Warn(stream, "Error waiting for stopped state");
+ }
vt.AAudioStream_close(sys->as);
sys->as = NULL;
+ sys->error = false;
}
static aaudio_channel_mask_t
@@ -749,8 +753,9 @@ Flush(aout_stream_t *stream)
struct sys *sys = stream->sys;
aaudio_stream_state_t state = GetState(stream);
- if (state == AAUDIO_STREAM_STATE_UNINITIALIZED
- || state == AAUDIO_STREAM_STATE_OPEN)
+ if (state == AAUDIO_STREAM_STATE_UNINITIALIZED)
+ goto error;
+ if (state == AAUDIO_STREAM_STATE_OPEN)
return;
/* Flush must be requested while PAUSED */
@@ -758,19 +763,20 @@ Flush(aout_stream_t *stream)
if (state != AAUDIO_STREAM_STATE_PAUSING
&& state != AAUDIO_STREAM_STATE_PAUSED
&& RequestPause(stream) != VLC_SUCCESS)
- return;
+ goto error;
state = GetState(stream);
if (state == AAUDIO_STREAM_STATE_PAUSING
&& WaitState(stream, AAUDIO_STREAM_STATE_PAUSED) != VLC_SUCCESS)
- return;
+ goto error;
if (RequestFlush(stream) != VLC_SUCCESS)
- return;
+ goto error;
if (WaitState(stream, AAUDIO_STREAM_STATE_FLUSHED) != VLC_SUCCESS)
- return;
+ goto error;
+error:
CloseAAudioStream(stream);
vlc_frame_ChainRelease(sys->frame_chain);
@@ -807,22 +813,13 @@ static void
Drain(aout_stream_t *stream)
{
struct sys *sys = stream->sys;
- aaudio_stream_state_t state = GetState(stream);
vlc_mutex_lock(&sys->lock);
sys->draining = true;
vlc_mutex_unlock(&sys->lock);
- /* In case of differed start, the stream may not have been started yet */
- if (unlikely(state != AAUDIO_STREAM_STATE_STARTED))
- {
- if (state != AAUDIO_STREAM_STATE_STARTING
- && RequestStart(stream) != VLC_SUCCESS)
- return;
-
- if (WaitState(stream, AAUDIO_STREAM_STATE_STARTED) != VLC_SUCCESS)
- return;
- }
+ if (unlikely(sys->first_play_date == VLC_TICK_INVALID))
+ aout_stream_DrainedReport(stream);
}
static void
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/047f56d00af5b25657c1eccbaff1384b1cda5d10...6df8b9ecf9843128d11336ac79bb37e3cab772a4
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/047f56d00af5b25657c1eccbaff1384b1cda5d10...6df8b9ecf9843128d11336ac79bb37e3cab772a4
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