diff options
author | Moonchild <moonchild@palemoon.org> | 2021-04-30 21:22:08 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2021-04-30 21:22:08 +0000 |
commit | 0dd3424f774954627d6f53df9fb47379d9b5c871 (patch) | |
tree | d8c303bac59a5bbbbc6c6f5e541a01dec1a5ae49 /dom/media/GraphDriver.cpp | |
parent | 5e705bd5059da5b7a39e3a096b7c7f59cb466730 (diff) | |
download | uxp-0dd3424f774954627d6f53df9fb47379d9b5c871.tar.gz |
Issue #1751 -- Remove XP_MACOSX conditionals from /dom
Diffstat (limited to 'dom/media/GraphDriver.cpp')
-rw-r--r-- | dom/media/GraphDriver.cpp | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/dom/media/GraphDriver.cpp b/dom/media/GraphDriver.cpp index e8b71a2318..90680d8c69 100644 --- a/dom/media/GraphDriver.cpp +++ b/dom/media/GraphDriver.cpp @@ -14,10 +14,6 @@ #include "webrtc/MediaEngineWebRTC.h" #endif -#ifdef XP_MACOSX -#include <sys/sysctl.h> -#endif - extern mozilla::LazyLogModule gMediaStreamGraphLog; #define STREAM_LOG(type, msg) MOZ_LOG(gMediaStreamGraphLog, type, msg) @@ -586,32 +582,6 @@ AudioCallbackDriver::~AudioCallbackDriver() MOZ_ASSERT(mPromisesForOperation.IsEmpty()); } -bool IsMacbookOrMacbookAir() -{ -#ifdef XP_MACOSX - size_t len = 0; - sysctlbyname("hw.model", NULL, &len, NULL, 0); - if (len) { - UniquePtr<char[]> model(new char[len]); - // This string can be - // MacBook%d,%d for a normal MacBook - // MacBookPro%d,%d for a MacBook Pro - // MacBookAir%d,%d for a Macbook Air - sysctlbyname("hw.model", model.get(), &len, NULL, 0); - char* substring = strstr(model.get(), "MacBook"); - if (substring) { - const size_t offset = strlen("MacBook"); - if (strncmp(model.get() + offset, "Air", len - offset) || - isdigit(model[offset + 1])) { - return true; - } - } - return false; - } -#endif - return false; -} - void AudioCallbackDriver::Init() { @@ -648,13 +618,6 @@ AudioCallbackDriver::Init() } } - // Macbook and MacBook air don't have enough CPU to run very low latency - // MediaStreamGraphs, cap the minimal latency to 512 frames int this case. - if (IsMacbookOrMacbookAir()) { - latency_frames = std::max((uint32_t) 512, latency_frames); - } - - input = output; input.channels = mInputChannels; // change to support optional stereo capture @@ -1068,44 +1031,6 @@ AudioCallbackDriver::MixerCallback(AudioDataValue* aMixedBuffer, NS_WARNING_ASSERTION(written == aFrames - toWrite, "Dropping frames."); }; -void AudioCallbackDriver::PanOutputIfNeeded(bool aMicrophoneActive) -{ -#ifdef XP_MACOSX - cubeb_device* out; - int rv; - char name[128]; - size_t length = sizeof(name); - - rv = sysctlbyname("hw.model", name, &length, NULL, 0); - if (rv) { - return; - } - - if (!strncmp(name, "MacBookPro", 10)) { - if (cubeb_stream_get_current_device(mAudioStream, &out) == CUBEB_OK) { - // Check if we are currently outputing sound on external speakers. - if (!strcmp(out->output_name, "ispk")) { - // Pan everything to the right speaker. - if (aMicrophoneActive) { - if (cubeb_stream_set_panning(mAudioStream, 1.0) != CUBEB_OK) { - NS_WARNING("Could not pan audio output to the right."); - } - } else { - if (cubeb_stream_set_panning(mAudioStream, 0.0) != CUBEB_OK) { - NS_WARNING("Could not pan audio output to the center."); - } - } - } else { - if (cubeb_stream_set_panning(mAudioStream, 0.0) != CUBEB_OK) { - NS_WARNING("Could not pan audio output to the center."); - } - } - cubeb_stream_device_destroy(mAudioStream, out); - } - } -#endif -} - void AudioCallbackDriver::DeviceChangedCallback() { // Tell the audio engine the device has changed, it might want to reset some @@ -1114,9 +1039,6 @@ AudioCallbackDriver::DeviceChangedCallback() { if (mAudioInput) { mAudioInput->DeviceChanged(); } -#ifdef XP_MACOSX - PanOutputIfNeeded(mMicrophoneActive); -#endif } void @@ -1125,10 +1047,6 @@ AudioCallbackDriver::SetMicrophoneActive(bool aActive) MonitorAutoLock mon(mGraphImpl->GetMonitor()); mMicrophoneActive = aActive; - -#ifdef XP_MACOSX - PanOutputIfNeeded(mMicrophoneActive); -#endif } uint32_t |