Commit ab8c4b3c authored by Felix Paul Kühne's avatar Felix Paul Kühne
Browse files

patches: add 4 more patches against the audiounit aout to fix issues with...

patches: add 4 more patches against the audiounit aout to fix issues with non-stereo audio tracks and buffer underuns
parent b22fabf3
From d53127fcec0f13e4a77ae45e433666f10b25c1f6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
Date: Mon, 1 Apr 2013 16:49:48 +0200
Subject: [PATCH 1/4] audiounit_ios: fix multi-channel audio
---
modules/audio_output/audiounit_ios.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/modules/audio_output/audiounit_ios.c b/modules/audio_output/audiounit_ios.c
index 6574ea9..e4d28cc 100644
--- a/modules/audio_output/audiounit_ios.c
+++ b/modules/audio_output/audiounit_ios.c
@@ -199,9 +199,10 @@ static int StartAnalog(audio_output_t *p_aout, audio_sample_format_t *fmt)
AudioStreamBasicDescription streamDescription;
streamDescription.mSampleRate = fmt->i_rate;
fmt->i_format = VLC_CODEC_FL32;
+ fmt->i_physical_channels = AOUT_CHANS_STEREO;
streamDescription.mFormatID = kAudioFormatLinearPCM;
streamDescription.mFormatFlags = kAudioFormatFlagsNativeFloatPacked; // FL32
- streamDescription.mChannelsPerFrame = 2;
+ streamDescription.mChannelsPerFrame = aout_FormatNbChannels(fmt);
streamDescription.mFramesPerPacket = 1;
streamDescription.mBitsPerChannel = 32;
streamDescription.mBytesPerFrame = streamDescription.mBitsPerChannel * streamDescription.mChannelsPerFrame / 8;
@@ -323,7 +324,7 @@ static void Play (audio_output_t * p_aout, block_t * p_block)
}
/* move data to buffer */
- if (unlikely(TPCircularBufferProduceBytes(&p_sys->circular_buffer, p_block->p_buffer, p_block->i_buffer)))
+ if (unlikely(!TPCircularBufferProduceBytes(&p_sys->circular_buffer, p_block->p_buffer, p_block->i_buffer)))
msg_Warn(p_aout, "Audio buffer was dropped");
if (!p_sys->i_bytes_per_sample)
--
1.7.12.4 (Apple Git-37)
From ea8f1aaf72fb28e9f979a42b96d761796532e0dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
Date: Mon, 1 Apr 2013 16:51:10 +0200
Subject: [PATCH 2/4] audiounit_ios: remove a write-only variable and related
code
---
modules/audio_output/audiounit_ios.c | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/modules/audio_output/audiounit_ios.c b/modules/audio_output/audiounit_ios.c
index e4d28cc..24e1266 100644
--- a/modules/audio_output/audiounit_ios.c
+++ b/modules/audio_output/audiounit_ios.c
@@ -58,7 +58,6 @@
*****************************************************************************/
struct aout_sys_t
{
- uint8_t chans_to_reorder; /* do we need channel reordering */
uint8_t chan_table[AOUT_CHAN_MAX];
UInt32 i_numberOfChannels;
@@ -163,7 +162,6 @@ static int StartAnalog(audio_output_t *p_aout, audio_sample_format_t *fmt)
UInt32 i_param_size = 0;
AudioComponentDescription desc;
AURenderCallbackStruct callback;
- p_aout->sys->chans_to_reorder = 0;
OSStatus status;
/* Lets go find our Component */
@@ -314,15 +312,6 @@ static void Play (audio_output_t * p_aout, block_t * p_block)
p_sys->b_got_first_sample = true;
}
- /* Do the channel reordering */
- if (p_sys->chans_to_reorder) {
- aout_ChannelReorder(p_block->p_buffer,
- p_block->i_buffer,
- p_sys->chans_to_reorder,
- p_sys->chan_table,
- VLC_CODEC_FL32);
- }
-
/* move data to buffer */
if (unlikely(!TPCircularBufferProduceBytes(&p_sys->circular_buffer, p_block->p_buffer, p_block->i_buffer)))
msg_Warn(p_aout, "Audio buffer was dropped");
--
1.7.12.4 (Apple Git-37)
From 13592a7641bdeecaec39af1043e5bd806f082d08 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
Date: Mon, 1 Apr 2013 16:54:57 +0200
Subject: [PATCH 3/4] audiounit_ios: try to handle data drops more efficiently
Needs mooar testing
---
modules/audio_output/audiounit_ios.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/modules/audio_output/audiounit_ios.c b/modules/audio_output/audiounit_ios.c
index 24e1266..a4af9d2 100644
--- a/modules/audio_output/audiounit_ios.c
+++ b/modules/audio_output/audiounit_ios.c
@@ -392,9 +392,8 @@ static OSStatus RenderCallback(vlc_object_t *p_obj,
/* check if we have enough data */
if (!availableBytes) {
- /* return an empty buffer so silence is played until we have data */
- for (UInt32 j = 0; j < inNumberFrames; j++)
- targetBuffer[j] = 0.;
+ /* bail out and restart unit the next time we receive some data */
+ Flush(p_aout, false);
} else {
memcpy(targetBuffer, buffer, __MIN(bytesToCopy, availableBytes));
TPCircularBufferConsume(&p_sys->circular_buffer, __MIN(bytesToCopy, availableBytes));
--
1.7.12.4 (Apple Git-37)
From fccd961db6c7e33e3993be2d7d682344a9796c64 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
Date: Mon, 1 Apr 2013 17:06:01 +0200
Subject: [PATCH 4/4] audiounit_ios: more cleanup
---
modules/audio_output/audiounit_ios.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/modules/audio_output/audiounit_ios.c b/modules/audio_output/audiounit_ios.c
index a4af9d2..1faaf58 100644
--- a/modules/audio_output/audiounit_ios.c
+++ b/modules/audio_output/audiounit_ios.c
@@ -58,9 +58,6 @@
*****************************************************************************/
struct aout_sys_t
{
- uint8_t chan_table[AOUT_CHAN_MAX];
-
- UInt32 i_numberOfChannels;
TPCircularBuffer circular_buffer; /* circular buffer to swap the audio data */
/* AUHAL specific */
@@ -70,8 +67,6 @@ struct aout_sys_t
int i_rate; /* media sample rate */
int i_bytes_per_sample;
bool b_got_first_sample;
-
- vlc_mutex_t lock;
};
#pragma mark -
@@ -109,8 +104,6 @@ static int Open(vlc_object_t *obj)
if (unlikely(sys == NULL))
return VLC_ENOMEM;
- vlc_mutex_init(&sys->lock);
-
aout->sys = sys;
aout->start = Start;
aout->stop = Stop;
@@ -123,8 +116,6 @@ static void Close(vlc_object_t *obj)
audio_output_t *aout = (audio_output_t *)obj;
aout_sys_t *sys = aout->sys;
- vlc_mutex_destroy(&sys->lock);
-
free(sys);
}
--
1.7.12.4 (Apple Git-37)
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