Commit 739c7a82 authored by Tobias Conradi's avatar Tobias Conradi Committed by Felix Paul Kühne

move audio unit initialization after audio session initialization and setup...

move audio unit initialization after audio session initialization and setup fixes issues when trying to start playback from background
Signed-off-by: default avatarFelix Paul Kühne <fkuehne@videolan.org>
(cherry picked from commit 1ee464915748e9efb00464d2e926c27e1513a4bd)
parent ee4b91b9
...@@ -252,13 +252,6 @@ static int StartAnalog(audio_output_t *p_aout, audio_sample_format_t *fmt) ...@@ -252,13 +252,6 @@ static int StartAnalog(audio_output_t *p_aout, audio_sample_format_t *fmt)
return false; return false;
} }
/* AU init */
status = AudioUnitInitialize(p_sys->au_unit);
if (status != noErr) {
msg_Err(p_aout, "failed to init AudioUnit (%i)", (int)status);
return false;
}
/* setup circular buffer */ /* setup circular buffer */
TPCircularBufferInit(&p_sys->circular_buffer, AUDIO_BUFFER_SIZE_IN_SECONDS * fmt->i_rate * fmt->i_bytes_per_frame); TPCircularBufferInit(&p_sys->circular_buffer, AUDIO_BUFFER_SIZE_IN_SECONDS * fmt->i_rate * fmt->i_bytes_per_frame);
...@@ -268,10 +261,17 @@ static int StartAnalog(audio_output_t *p_aout, audio_sample_format_t *fmt) ...@@ -268,10 +261,17 @@ static int StartAnalog(audio_output_t *p_aout, audio_sample_format_t *fmt)
NULL, NULL,
NULL); NULL);
/* Set audio session to mediaplayback */ /* Set audio session to mediaplayback */
UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback; UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback;
AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(sessionCategory),&sessionCategory); AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(sessionCategory),&sessionCategory);
AudioSessionSetActive(true); AudioSessionSetActive(true);
/* AU init */
status = AudioUnitInitialize(p_sys->au_unit);
if (status != noErr) {
msg_Err(p_aout, "failed to init AudioUnit (%i)", (int)status);
return false;
}
/* start the unit */ /* start the unit */
status = AudioOutputUnitStart(p_sys->au_unit); status = AudioOutputUnitStart(p_sys->au_unit);
......
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