[vlc-devel] [RFC 11/38] audio_output/winstore: removed usage of abort
Filip Roséen
filip at videolabs.io
Mon Jun 27 13:43:22 CEST 2016
---
modules/audio_output/winstore.c | 32 ++++++++++++++++++++++++--------
1 file changed, 24 insertions(+), 8 deletions(-)
diff --git a/modules/audio_output/winstore.c b/modules/audio_output/winstore.c
index a292841..a5b3809 100644
--- a/modules/audio_output/winstore.c
+++ b/modules/audio_output/winstore.c
@@ -38,11 +38,15 @@
DEFINE_GUID (GUID_VLC_AUD_OUT, 0x4533f59d, 0x59ee, 0x00c6,
0xad, 0xb2, 0xc6, 0x8b, 0x50, 0x1a, 0x66, 0x55);
-static void EnterMTA(void)
+static int EnterMTA( audio_output_t* aout )
{
HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
if (unlikely(FAILED(hr)))
- abort();
+ {
+ msg_Err( aout, "%s: unsuccessful call to CoInitializeEx", __func__ );
+ return VLC_EGENERIC;
+ }
+ return VLC_SUCCESS;
}
static void LeaveMTA(void)
@@ -126,7 +130,9 @@ static int TimeGet(audio_output_t *aout, mtime_t *restrict delay)
aout_sys_t *sys = aout->sys;
HRESULT hr;
- EnterMTA();
+ if( EnterMTA( aout ) )
+ return VLC_EGENERIC;
+
hr = aout_stream_TimeGet(sys->stream, delay);
LeaveMTA();
@@ -137,7 +143,9 @@ static void Play(audio_output_t *aout, block_t *block)
{
aout_sys_t *sys = aout->sys;
- EnterMTA();
+ if( EnterMTA( aout ) )
+ return;
+
aout_stream_Play(sys->stream, block);
LeaveMTA();
}
@@ -146,7 +154,9 @@ static void Pause(audio_output_t *aout, bool paused, mtime_t date)
{
aout_sys_t *sys = aout->sys;
- EnterMTA();
+ if( EnterMTA( aout ) )
+ return;
+
aout_stream_Pause(sys->stream, paused);
LeaveMTA();
@@ -157,7 +167,9 @@ static void Flush(audio_output_t *aout, bool wait)
{
aout_sys_t *sys = aout->sys;
- EnterMTA();
+ if( EnterMTA( aout ) )
+ return;
+
aout_stream_Flush(sys->stream, wait);
LeaveMTA();
}
@@ -209,7 +221,9 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
s->owner.device = sys->client;
s->owner.activate = ActivateDevice;
- EnterMTA();
+ if( EnterMTA( aout ) )
+ return VLC_EGENERIC;
+
sys->module = vlc_module_load(s, "aout stream", NULL, false,
aout_stream_Start, s, fmt, &hr);
LeaveMTA();
@@ -231,7 +245,9 @@ static void Stop(audio_output_t *aout)
assert (sys->stream != NULL);
- EnterMTA();
+ if( EnterMTA( aout ) )
+ return;
+
vlc_module_unload(sys->module, aout_stream_Stop, sys->stream);
LeaveMTA();
--
2.9.0
More information about the vlc-devel
mailing list