mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 939593 - Resync libcubeb with upstream. r=kinetik
This commit is contained in:
parent
19d50159cb
commit
c232937fab
@ -2,3 +2,5 @@ Matthew Gregan <kinetik@flim.org>
|
||||
Alexandre Ratchov <alex@caoua.org>
|
||||
Michael Wu <mwu@mozilla.com>
|
||||
Paul Adenot <paul@paul.cx>
|
||||
David Richards <drichards@mozilla.com>
|
||||
Sebastien Alaiwan <sebastien.alaiwan@gmail.com>
|
||||
|
@ -5,4 +5,4 @@ Makefile.in build files for the Mozilla build system.
|
||||
|
||||
The cubeb git repository is: git://github.com/kinetiknz/cubeb.git
|
||||
|
||||
The git commit ID used was 36659a5649fb31c180c39e70ea761e00354c0106.
|
||||
The git commit ID used was 93e51e70e978420c745ec22503fa8e121cbb7aa5.
|
||||
|
@ -24,6 +24,9 @@ struct cubeb_stream {
|
||||
#if defined(USE_PULSE)
|
||||
int pulse_init(cubeb ** context, char const * context_name);
|
||||
#endif
|
||||
#if defined(USE_JACK)
|
||||
int jack_init (cubeb ** context, char const * context_name);
|
||||
#endif
|
||||
#if defined(USE_ALSA)
|
||||
int alsa_init(cubeb ** context, char const * context_name);
|
||||
#endif
|
||||
@ -87,6 +90,9 @@ cubeb_init(cubeb ** context, char const * context_name)
|
||||
#if defined(USE_PULSE)
|
||||
pulse_init,
|
||||
#endif
|
||||
#if defined(USE_JACK)
|
||||
jack_init,
|
||||
#endif
|
||||
#if defined(USE_ALSA)
|
||||
alsa_init,
|
||||
#endif
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include <CoreAudio/HostTime.h>
|
||||
#include "cubeb/cubeb.h"
|
||||
#include "cubeb-internal.h"
|
||||
#include "prtime.h"
|
||||
|
||||
#define NBUFS 4
|
||||
|
||||
@ -49,7 +48,7 @@ audiotimestamp_to_latency(AudioTimeStamp const * tstamp, cubeb_stream * stream)
|
||||
uint64_t pres = AudioConvertHostTimeToNanos(tstamp->mHostTime);
|
||||
uint64_t now = AudioConvertHostTimeToNanos(AudioGetCurrentHostTime());
|
||||
|
||||
return ((pres - now) * stream->sample_spec.mSampleRate) / PR_NSEC_PER_SEC;
|
||||
return ((pres - now) * stream->sample_spec.mSampleRate) / 1000000000LL;
|
||||
}
|
||||
|
||||
static OSStatus
|
||||
@ -299,7 +298,7 @@ audiounit_stream_init(cubeb * context, cubeb_stream ** stream, char const * stre
|
||||
#endif
|
||||
cubeb_stream * stm;
|
||||
AURenderCallbackStruct input;
|
||||
unsigned int buffer_size;
|
||||
unsigned int buffer_size, default_buffer_size;
|
||||
OSStatus r;
|
||||
UInt32 size;
|
||||
AudioDeviceID output_device_id;
|
||||
@ -408,15 +407,30 @@ audiounit_stream_init(cubeb * context, cubeb_stream ** stream, char const * stre
|
||||
buffer_size = (unsigned int) latency_range.mMaximum;
|
||||
}
|
||||
|
||||
/* Set the maximum number of frame that the render callback will ask for,
|
||||
* effectively setting the latency of the stream. This is process-wide. */
|
||||
r = AudioUnitSetProperty(stm->unit, kAudioDevicePropertyBufferFrameSize,
|
||||
kAudioUnitScope_Output, 0, &buffer_size, sizeof(buffer_size));
|
||||
/**
|
||||
* Get the default buffer size. If our latency request is below the default,
|
||||
* set it. Otherwise, use the default latency.
|
||||
**/
|
||||
size = sizeof(default_buffer_size);
|
||||
r = AudioUnitGetProperty(stm->unit, kAudioDevicePropertyBufferFrameSize,
|
||||
kAudioUnitScope_Output, 0, &default_buffer_size, &size);
|
||||
|
||||
if (r != 0) {
|
||||
audiounit_stream_destroy(stm);
|
||||
return CUBEB_ERROR;
|
||||
}
|
||||
|
||||
if (buffer_size < default_buffer_size) {
|
||||
/* Set the maximum number of frame that the render callback will ask for,
|
||||
* effectively setting the latency of the stream. This is process-wide. */
|
||||
r = AudioUnitSetProperty(stm->unit, kAudioDevicePropertyBufferFrameSize,
|
||||
kAudioUnitScope_Output, 0, &buffer_size, sizeof(buffer_size));
|
||||
if (r != 0) {
|
||||
audiounit_stream_destroy(stm);
|
||||
return CUBEB_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
r = AudioUnitSetProperty(stm->unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input,
|
||||
0, &ss, sizeof(ss));
|
||||
if (r != 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user