Bug 1581902 - p5: check H.264 hardware availability. r=pehrsons

Differential Revision: https://phabricator.services.mozilla.com/D46367

--HG--
extra : moz-landing-system : lando
This commit is contained in:
John Lin 2019-10-01 16:54:41 +00:00
parent 572a122361
commit 854d85bd05
3 changed files with 18 additions and 0 deletions

View File

@ -2305,4 +2305,17 @@ bool WebrtcVideoConduit::RequiresNewSendStream(
;
}
bool WebrtcVideoConduit::HasH264Hardware() {
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
if (!gfxInfo) {
return false;
}
int32_t status;
nsCString discardFailureId;
return NS_SUCCEEDED(gfxInfo->GetFeatureStatus(
nsIGfxInfo::FEATURE_WEBRTC_HW_ACCELERATION_H264, discardFailureId,
&status)) &&
status == nsIGfxInfo::FEATURE_STATUS_OK;
}
} // namespace mozilla

View File

@ -76,6 +76,9 @@ class WebrtcVideoConduit
// VoiceEngine defined constant for Payload Name Size.
static const unsigned int CODEC_PLNAME_SIZE;
// Returns true when both encoder and decoder are HW accelerated.
static bool HasH264Hardware();
MediaConduitErrorCode SetLocalRTPExtensions(
MediaSessionConduitLocalDirection aDirection,
const RtpExtList& aExtensions) override;

View File

@ -637,6 +637,8 @@ class ConfigureCodec {
mDtmfEnabled(false) {
mSoftwareH264Enabled = PeerConnectionCtx::GetInstance()->gmpHasH264();
mHardwareH264Supported = WebrtcVideoConduit::HasH264Hardware();
mH264Enabled = mHardwareH264Supported || mSoftwareH264Enabled;
branch->GetIntPref("media.navigator.video.h264.level", &mH264Level);