mac-capture: If channels above 8, force to stereo
Certain devices (particularly certain mixers and soundflower 64ch) would have an arbitrary number of channels, and wouldn't really be mappable to a specific speaker layout supported by libobs. So to fix this issue, if the channel count is above 8, force the data to stereo to ensure playback can still occur, rather than cause it to just fail.
This commit is contained in:
parent
d44d3b1f0a
commit
f3104d92d5
@ -203,6 +203,16 @@ static bool coreaudio_init_format(struct coreaudio_data *ca)
|
||||
if (!ca_success(stat, ca, "coreaudio_init_format", "get input format"))
|
||||
return false;
|
||||
|
||||
/* Certain types of devices have no limit on channel count, and
|
||||
* there's no way to know the actual number of channels it's using,
|
||||
* so if we encounter this situation just force to stereo */
|
||||
if (desc.mChannelsPerFrame > 8) {
|
||||
desc.mChannelsPerFrame = 2;
|
||||
desc.mBytesPerFrame = 2 * desc.mBitsPerChannel / 8;
|
||||
desc.mBytesPerPacket =
|
||||
desc.mFramesPerPacket * desc.mBytesPerFrame;
|
||||
}
|
||||
|
||||
stat = set_property(ca->unit, kAudioUnitProperty_StreamFormat,
|
||||
SCOPE_OUTPUT, BUS_INPUT, &desc, size);
|
||||
if (!ca_success(stat, ca, "coreaudio_init_format", "set output format"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user