@@ -119,8 +119,6 @@ AudioDeviceMac::AudioDeviceMac()
119
119
_twoDevices(true ),
120
120
_doStop(false ),
121
121
_doStopRec(false ),
122
- _macBookPro(false ),
123
- _macBookProPanRight(false ),
124
122
_captureLatencyUs(0 ),
125
123
_renderLatencyUs(0 ),
126
124
_captureDelayUs(0 ),
@@ -294,23 +292,6 @@ AudioDeviceGeneric::InitStatus AudioDeviceMac::Init() {
294
292
WEBRTC_CA_LOG_ERR (AudioObjectAddPropertyListener (
295
293
kAudioObjectSystemObject , &propertyAddress, &objectListenerProc, this ));
296
294
297
- // Determine if this is a MacBook Pro
298
- _macBookPro = false ;
299
- _macBookProPanRight = false ;
300
- char buf[128 ];
301
- size_t length = sizeof (buf);
302
- memset (buf, 0 , length);
303
-
304
- int intErr = sysctlbyname (" hw.model" , buf, &length, NULL , 0 );
305
- if (intErr != 0 ) {
306
- RTC_LOG (LS_ERROR) << " Error in sysctlbyname(): " << err;
307
- } else {
308
- RTC_LOG (LS_VERBOSE) << " Hardware model: " << buf;
309
- if (strncmp (buf, " MacBookPro" , 10 ) == 0 ) {
310
- _macBookPro = true ;
311
- }
312
- }
313
-
314
295
_initialized = true ;
315
296
316
297
return InitStatus::OK;
@@ -979,34 +960,8 @@ int32_t AudioDeviceMac::InitPlayout() {
979
960
_renderDeviceIsAlive = 1 ;
980
961
_doStop = false ;
981
962
982
- // The internal microphone of a MacBook Pro is located under the left speaker
983
- // grille. When the internal speakers are in use, we want to fully stereo
984
- // pan to the right.
985
963
AudioObjectPropertyAddress propertyAddress = {
986
964
kAudioDevicePropertyDataSource , kAudioDevicePropertyScopeOutput , 0 };
987
- if (_macBookPro) {
988
- _macBookProPanRight = false ;
989
- Boolean hasProperty =
990
- AudioObjectHasProperty (_outputDeviceID, &propertyAddress);
991
- if (hasProperty) {
992
- UInt32 dataSource = 0 ;
993
- size = sizeof (dataSource);
994
- WEBRTC_CA_LOG_WARN (AudioObjectGetPropertyData (
995
- _outputDeviceID, &propertyAddress, 0 , NULL , &size, &dataSource));
996
-
997
- if (dataSource == ' ispk' ) {
998
- _macBookProPanRight = true ;
999
- RTC_LOG (LS_VERBOSE)
1000
- << " MacBook Pro using internal speakers; stereo panning right" ;
1001
- } else {
1002
- RTC_LOG (LS_VERBOSE) << " MacBook Pro not using internal speakers" ;
1003
- }
1004
-
1005
- // Add a listener to determine if the status changes.
1006
- WEBRTC_CA_LOG_WARN (AudioObjectAddPropertyListener (
1007
- _outputDeviceID, &propertyAddress, &objectListenerProc, this ));
1008
- }
1009
- }
1010
965
1011
966
// Get current stream description
1012
967
propertyAddress.mSelector = kAudioDevicePropertyStreamFormat ;
@@ -1511,16 +1466,6 @@ int32_t AudioDeviceMac::StopPlayout() {
1511
1466
WEBRTC_CA_LOG_WARN (AudioObjectRemovePropertyListener (
1512
1467
_outputDeviceID, &propertyAddress, &objectListenerProc, this ));
1513
1468
1514
- if (_macBookPro) {
1515
- Boolean hasProperty =
1516
- AudioObjectHasProperty (_outputDeviceID, &propertyAddress);
1517
- if (hasProperty) {
1518
- propertyAddress.mSelector = kAudioDevicePropertyDataSource ;
1519
- WEBRTC_CA_LOG_WARN (AudioObjectRemovePropertyListener (
1520
- _outputDeviceID, &propertyAddress, &objectListenerProc, this ));
1521
- }
1522
- }
1523
-
1524
1469
_playIsInitialized = false ;
1525
1470
_playing = false ;
1526
1471
@@ -2061,28 +2006,10 @@ int32_t AudioDeviceMac::HandleStreamFormatChange(
2061
2006
int32_t AudioDeviceMac::HandleDataSourceChange (
2062
2007
const AudioObjectID objectId,
2063
2008
const AudioObjectPropertyAddress propertyAddress) {
2064
- OSStatus err = noErr;
2065
-
2066
- if (_macBookPro &&
2067
- propertyAddress.mScope == kAudioDevicePropertyScopeOutput ) {
2068
- RTC_LOG (LS_VERBOSE) << " Data source changed" ;
2069
-
2070
- _macBookProPanRight = false ;
2071
- UInt32 dataSource = 0 ;
2072
- UInt32 size = sizeof (UInt32);
2073
- WEBRTC_CA_RETURN_ON_ERR (AudioObjectGetPropertyData (
2074
- objectId, &propertyAddress, 0 , NULL , &size, &dataSource));
2075
- if (dataSource == ' ispk' ) {
2076
- _macBookProPanRight = true ;
2077
- RTC_LOG (LS_VERBOSE)
2078
- << " MacBook Pro using internal speakers; stereo panning right" ;
2079
- } else {
2080
- RTC_LOG (LS_VERBOSE) << " MacBook Pro not using internal speakers" ;
2081
- }
2082
- }
2083
2009
2084
2010
return 0 ;
2085
2011
}
2012
+
2086
2013
int32_t AudioDeviceMac::HandleProcessorOverload (
2087
2014
const AudioObjectPropertyAddress propertyAddress) {
2088
2015
// TODO(xians): we probably want to notify the user in some way of the
@@ -2400,24 +2327,6 @@ bool AudioDeviceMac::RenderWorkerThread() {
2400
2327
uint32_t nOutSamples = nSamples * _outDesiredFormat.mChannelsPerFrame ;
2401
2328
2402
2329
SInt16* pPlayBuffer = (SInt16*)&playBuffer;
2403
- if (_macBookProPanRight && (_playChannels == 2 )) {
2404
- // Mix entirely into the right channel and zero the left channel.
2405
- SInt32 sampleInt32 = 0 ;
2406
- for (uint32_t sampleIdx = 0 ; sampleIdx < nOutSamples; sampleIdx += 2 ) {
2407
- sampleInt32 = pPlayBuffer[sampleIdx];
2408
- sampleInt32 += pPlayBuffer[sampleIdx + 1 ];
2409
- sampleInt32 /= 2 ;
2410
-
2411
- if (sampleInt32 > 32767 ) {
2412
- sampleInt32 = 32767 ;
2413
- } else if (sampleInt32 < -32768 ) {
2414
- sampleInt32 = -32768 ;
2415
- }
2416
-
2417
- pPlayBuffer[sampleIdx] = 0 ;
2418
- pPlayBuffer[sampleIdx + 1 ] = static_cast <SInt16>(sampleInt32);
2419
- }
2420
- }
2421
2330
2422
2331
PaUtil_WriteRingBuffer (_paRenderBuffer, pPlayBuffer, nOutSamples);
2423
2332
0 commit comments