mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 00:06:36 +00:00
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.
This commit is contained in:
parent
1dc5c34143
commit
555c804b7d
1 changed files with 7 additions and 4 deletions
|
@ -412,8 +412,8 @@ gst_osx_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
spec->segsize = 4096;
|
spec->segsize = (spec->latency_time * spec->rate / G_USEC_PER_SEC) * spec->bytes_per_sample;
|
||||||
spec->segtotal = 16;
|
spec->segtotal = spec->buffer_time / spec->latency_time;
|
||||||
|
|
||||||
/* create AudioBufferList needed for recording */
|
/* create AudioBufferList needed for recording */
|
||||||
if (osxbuf->is_src) {
|
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);
|
buf->data = gst_buffer_new_and_alloc (spec->segtotal * spec->segsize);
|
||||||
memset (GST_BUFFER_DATA (buf->data), 0, GST_BUFFER_SIZE (buf->data));
|
memset (GST_BUFFER_DATA (buf->data), 0, GST_BUFFER_SIZE (buf->data));
|
||||||
|
|
||||||
|
osxbuf->segoffset = 0;
|
||||||
|
|
||||||
status = AudioUnitInitialize (osxbuf->audiounit);
|
status = AudioUnitInitialize (osxbuf->audiounit);
|
||||||
if (status) {
|
if (status) {
|
||||||
gst_buffer_unref (buf->data);
|
gst_buffer_unref (buf->data);
|
||||||
|
@ -568,8 +570,9 @@ gst_osx_ring_buffer_start (GstRingBuffer * buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
osxbuf->io_proc_active = TRUE;
|
osxbuf->io_proc_active = TRUE;
|
||||||
} else
|
}
|
||||||
osxbuf->io_proc_needs_deactivation = FALSE;
|
|
||||||
|
osxbuf->io_proc_needs_deactivation = FALSE;
|
||||||
|
|
||||||
status = AudioOutputUnitStart (osxbuf->audiounit);
|
status = AudioOutputUnitStart (osxbuf->audiounit);
|
||||||
if (status) {
|
if (status) {
|
||||||
|
|
Loading…
Reference in a new issue