diff options
author | Michael Smith <msmith@songbirdnest.com> | 2009-02-04 16:40:13 -0800 |
---|---|---|
committer | Michael Smith <msmith@songbirdnest.com> | 2009-02-04 16:40:13 -0800 |
commit | 555c804b7d753955c8aa5330a6f591c25e65255d (patch) | |
tree | 5bd0aa9594c555913eee11232a255cdb125ae9b9 /sys/osxaudio | |
parent | 1dc5c341432f17f5b33c055fc5eae66ef52840f6 (diff) |
osxaudio fixes: multichannel and changing caps.
Ensure we create the ringbuffer segment size as a multiple of the
bytes per sample (fixes 6-channel output).
Reset the segoffset when acquiring the ringbuffer, so we don't retain
a bogus offset when caps change.
Diffstat (limited to 'sys/osxaudio')
-rw-r--r-- | sys/osxaudio/gstosxringbuffer.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/osxaudio/gstosxringbuffer.c b/sys/osxaudio/gstosxringbuffer.c index f6fd2e52..f6a72db7 100644 --- a/sys/osxaudio/gstosxringbuffer.c +++ b/sys/osxaudio/gstosxringbuffer.c @@ -412,8 +412,8 @@ gst_osx_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec) goto done; } - spec->segsize = 4096; - spec->segtotal = 16; + spec->segsize = (spec->latency_time * spec->rate / G_USEC_PER_SEC) * spec->bytes_per_sample; + spec->segtotal = spec->buffer_time / spec->latency_time; /* create AudioBufferList needed for recording */ if (osxbuf->is_src) { @@ -433,6 +433,8 @@ gst_osx_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec) buf->data = gst_buffer_new_and_alloc (spec->segtotal * spec->segsize); memset (GST_BUFFER_DATA (buf->data), 0, GST_BUFFER_SIZE (buf->data)); + osxbuf->segoffset = 0; + status = AudioUnitInitialize (osxbuf->audiounit); if (status) { gst_buffer_unref (buf->data); @@ -568,8 +570,9 @@ gst_osx_ring_buffer_start (GstRingBuffer * buf) } osxbuf->io_proc_active = TRUE; - } else - osxbuf->io_proc_needs_deactivation = FALSE; + } + + osxbuf->io_proc_needs_deactivation = FALSE; status = AudioOutputUnitStart (osxbuf->audiounit); if (status) { |