This commit is contained in:
Paul Adenot 2016-07-01 09:15:39 +02:00
Родитель e562eaa439
Коммит e292d8cfb1
1 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -705,7 +705,7 @@ audiounit_get_max_channel_count(cubeb * ctx, uint32_t * max_channels)
}
static int
audiounit_get_min_latency(cubeb * ctx, cubeb_stream_params params, uint32_t * latency_ms)
audiounit_get_min_latency(cubeb * ctx, cubeb_stream_params params, uint32_t * latency_frames)
{
#if TARGET_OS_IPHONE
//TODO: [[AVAudioSession sharedInstance] inputLatency]
@ -716,7 +716,7 @@ audiounit_get_min_latency(cubeb * ctx, cubeb_stream_params params, uint32_t * la
return CUBEB_ERROR;
}
*latency_ms = ceil((latency_range.mMinimum * 1000 ) / params.rate);
*latency_frames = latency_range.mMinimum;
#endif
return CUBEB_OK;
@ -906,7 +906,7 @@ audiounit_stream_init(cubeb * context,
cubeb_stream_params * input_stream_params,
cubeb_devid output_device,
cubeb_stream_params * output_stream_params,
unsigned int latency,
unsigned int latency_frames,
cubeb_data_callback data_callback,
cubeb_state_callback state_callback,
void * user_ptr)
@ -1127,7 +1127,7 @@ audiounit_stream_init(cubeb * context,
// Setting the latency doesn't work well for USB headsets (eg. plantronics).
// Keep the default latency for now.
#if 0
buffer_size = latency / 1000.0 * ss.mSampleRate;
buffer_size = latency;
/* Get the range of latency this particular device can work with, and clamp
* the requested latency to this acceptable range. */
@ -1768,11 +1768,11 @@ audiounit_create_device_from_hwdev(AudioObjectID devid, cubeb_device_type type)
adr.mSelector = kAudioDevicePropertyBufferFrameSizeRange;
size = sizeof(AudioValueRange);
if (AudioObjectGetPropertyData(devid, &adr, 0, NULL, &size, &range) == noErr) {
ret->latency_lo_ms = ((latency + range.mMinimum) * 1000) / ret->default_rate;
ret->latency_hi_ms = ((latency + range.mMaximum) * 1000) / ret->default_rate;
ret->latency_lo = latency + range.mMinimum;
ret->latency_hi = latency + range.mMaximum;
} else {
ret->latency_lo_ms = 10; /* Default to 10ms */
ret->latency_hi_ms = 100; /* Default to 100ms */
ret->latency_lo = 10 * ret->default_rate / 1000; /* Default to 10ms */
ret->latency_hi = 100 * ret->default_rate / 1000; /* Default to 100ms */
}
return ret;