Skip to content

Commit

Permalink
Bug 1304597 - Remove hardcoded capabilities on OSX that are no longer…
Browse files Browse the repository at this point in the history
… used r=jesup

MozReview-Commit-ID: 4vENDI1Q9U1
  • Loading branch information
jan-ivar committed Oct 7, 2016
1 parent 5810afc commit 6668691
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 41 deletions.
2 changes: 1 addition & 1 deletion dom/media/webrtc/MediaEngineCameraVideoSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
46 changes: 6 additions & 40 deletions dom/media/webrtc/MediaEngineRemoteVideoSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6668691

Please sign in to comment.