From 6668691c207c1141b9f6a3c329b6c8f67cd73c0e Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Fri, 7 Oct 2016 11:35:07 -0400 Subject: [PATCH] Bug 1304597 - Remove hardcoded capabilities on OSX that are no longer used r=jesup MozReview-Commit-ID: 4vENDI1Q9U1 --- .../webrtc/MediaEngineCameraVideoSource.cpp | 2 +- .../webrtc/MediaEngineRemoteVideoSource.cpp | 46 +++---------------- 2 files changed, 7 insertions(+), 41 deletions(-) diff --git a/dom/media/webrtc/MediaEngineCameraVideoSource.cpp b/dom/media/webrtc/MediaEngineCameraVideoSource.cpp index c266d61e20807..95e555a3a6a88 100644 --- a/dom/media/webrtc/MediaEngineCameraVideoSource.cpp +++ b/dom/media/webrtc/MediaEngineCameraVideoSource.cpp @@ -49,7 +49,7 @@ MediaEngineCameraVideoSource::GetCapability(size_t aIndex, webrtc::CaptureCapability& aOut) const { MOZ_ASSERT(aIndex < mHardcodedCapabilities.Length()); - aOut = mHardcodedCapabilities[aIndex]; + aOut = mHardcodedCapabilities.SafeElementAt(aIndex, webrtc::CaptureCapability()); } uint32_t diff --git a/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp b/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp index 666600a0ccb52..ef2128fbcc3cb 100644 --- a/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp +++ b/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp @@ -420,53 +420,19 @@ MediaEngineRemoteVideoSource::DeliverFrame(unsigned char* buffer, size_t MediaEngineRemoteVideoSource::NumCapabilities() const { + mHardcodedCapabilities.Clear(); int num = mozilla::camera::GetChildAndCall( &mozilla::camera::CamerasChild::NumberOfCapabilities, mCapEngine, GetUUID().get()); - if (num > 0) { - return num; - } - - switch(mMediaSource) { - case dom::MediaSourceEnum::Camera: -#ifdef XP_MACOSX - // Mac doesn't support capabilities. - // - // Hardcode generic desktop capabilities modeled on OSX camera. - // Note: Values are empirically picked to be OSX friendly, as on OSX, values - // other than these cause the source to not produce. - - if (mHardcodedCapabilities.IsEmpty()) { - for (int i = 0; i < 9; i++) { - webrtc::CaptureCapability c; - c.width = 1920 - i*128; - c.height = 1080 - i*72; - c.maxFPS = 30; - mHardcodedCapabilities.AppendElement(c); - } - for (int i = 0; i < 16; i++) { - webrtc::CaptureCapability c; - c.width = 640 - i*40; - c.height = 480 - i*30; - c.maxFPS = 30; - mHardcodedCapabilities.AppendElement(c); - } - } - break; -#endif - default: - webrtc::CaptureCapability c; + if (num < 1) { // The default for devices that don't return discrete capabilities: treat // them as supporting all capabilities orthogonally. E.g. screensharing. - c.width = 0; // 0 = accept any value - c.height = 0; - c.maxFPS = 0; - mHardcodedCapabilities.AppendElement(c); - break; + // CaptureCapability defaults key values to 0, which means accept any value. + mHardcodedCapabilities.AppendElement(webrtc::CaptureCapability()); + num = mHardcodedCapabilities.Length(); // 1 } - - return mHardcodedCapabilities.Length(); + return num; } bool