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) {
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);
}
osxbuf->io_proc_active = TRUE;
- } else
- osxbuf->io_proc_needs_deactivation = FALSE;
+ }
+
+ osxbuf->io_proc_needs_deactivation = FALSE;
status = AudioOutputUnitStart (osxbuf->audiounit);
if (status) {