diff --git a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp index 58c52177af5..83d40507689 100644 --- a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp +++ b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp @@ -143,13 +143,12 @@ WebrtcGmpVideoEncoder::InitEncode(const webrtc::VideoCodec* aCodecSettings, int32_t aNumberOfCores, uint32_t aMaxPayloadSize) { - if (!mMPS) { - mMPS = do_GetService("@mozilla.org/gecko-media-plugin-service;1"); - } + mMPS = do_GetService("@mozilla.org/gecko-media-plugin-service;1"); MOZ_ASSERT(mMPS); if (!mGMPThread) { if (NS_WARN_IF(NS_FAILED(mMPS->GetThread(getter_AddRefs(mGMPThread))))) { + mMPS = nullptr; return WEBRTC_VIDEO_CODEC_ERROR; } } @@ -183,30 +182,31 @@ WebrtcGmpVideoEncoder::InitEncode_g(const webrtc::VideoCodec* aCodecSettings, mHost = nullptr; return WEBRTC_VIDEO_CODEC_ERROR; } + mMPS = nullptr; if (!mGMP || !mHost) { return WEBRTC_VIDEO_CODEC_ERROR; } // Bug XXXXXX: transfer settings from codecSettings to codec. - memset(&mCodecParams, 0, sizeof(mCodecParams)); + GMPVideoCodec codec; + memset(&codec, 0, sizeof(codec)); - mCodecParams.mGMPApiVersion = 33; - mCodecParams.mWidth = aCodecSettings->width; - mCodecParams.mHeight = aCodecSettings->height; - mCodecParams.mStartBitrate = aCodecSettings->startBitrate; - mCodecParams.mMinBitrate = aCodecSettings->minBitrate; - mCodecParams.mMaxBitrate = aCodecSettings->maxBitrate; - mCodecParams.mMaxFramerate = aCodecSettings->maxFramerate; - mMaxPayloadSize = aMaxPayloadSize; + codec.mGMPApiVersion = 33; + codec.mWidth = aCodecSettings->width; + codec.mHeight = aCodecSettings->height; + codec.mStartBitrate = aCodecSettings->startBitrate; + codec.mMinBitrate = aCodecSettings->minBitrate; + codec.mMaxBitrate = aCodecSettings->maxBitrate; + codec.mMaxFramerate = aCodecSettings->maxFramerate; if (aCodecSettings->codecSpecific.H264.packetizationMode == 1) { - mMaxPayloadSize = 4*1024*1024; // insanely large + aMaxPayloadSize = 4*1024*1024; // insanely large } // Pass dummy codecSpecific data for now... nsTArray codecSpecific; - GMPErr err = mGMP->InitEncode(mCodecParams, codecSpecific, this, 1, mMaxPayloadSize); + GMPErr err = mGMP->InitEncode(codec, codecSpecific, this, 1, aMaxPayloadSize); if (err != GMPNoErr) { return WEBRTC_VIDEO_CODEC_ERROR; } @@ -245,38 +245,6 @@ WebrtcGmpVideoEncoder::Encode_g(const webrtc::I420VideoFrame* aInputImage, return WEBRTC_VIDEO_CODEC_ERROR; } - if (aInputImage->width() != mCodecParams.mWidth || - aInputImage->height() != mCodecParams.mHeight) { - LOGD(("GMP Encode: resolution change from %ux%u to %ux%u", - mCodecParams.mWidth, mCodecParams.mHeight, aInputImage->width(), aInputImage->height())); - - mGMP->Close(); - - // OpenH264 codec (at least) can't handle dynamic input resolution changes - // re-init the plugin when the resolution changes - // XXX allow codec to indicate it doesn't need re-init! - nsTArray tags; - tags.AppendElement(NS_LITERAL_CSTRING("h264")); - if (NS_WARN_IF(NS_FAILED(mMPS->GetGMPVideoEncoder(&tags, - NS_LITERAL_STRING(""), - &mHost, - &mGMP)))) { - mGMP = nullptr; - mHost = nullptr; - return WEBRTC_VIDEO_CODEC_ERROR; - } - - mCodecParams.mWidth = aInputImage->width(); - mCodecParams.mHeight = aInputImage->height(); - // Pass dummy codecSpecific data for now... - nsTArray codecSpecific; - - GMPErr err = mGMP->InitEncode(mCodecParams, codecSpecific, this, 1, mMaxPayloadSize); - if (err != GMPNoErr) { - return WEBRTC_VIDEO_CODEC_ERROR; - } - } - GMPVideoFrame* ftmp = nullptr; GMPErr err = mHost->CreateFrame(kGMPI420VideoFrame, &ftmp); if (err != GMPNoErr) { diff --git a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.h b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.h index 47b68bc93c8..bafc7dec3c2 100644 --- a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.h +++ b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.h @@ -92,8 +92,6 @@ private: nsCOMPtr mGMPThread; GMPVideoEncoderProxy* mGMP; GMPVideoHost* mHost; - GMPVideoCodec mCodecParams; - uint32_t mMaxPayloadSize; webrtc::EncodedImageCallback* mCallback; uint64_t mCachedPluginId; }; diff --git a/media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp b/media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp index cf8469823c2..577e9baa322 100644 --- a/media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp +++ b/media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp @@ -1719,11 +1719,12 @@ static int vcmEnsureExternalCodec( // Register H.264 codec. if (send) { - VideoEncoder* encoder = nullptr; + VideoEncoder* encoder = nullptr; #ifdef MOZ_WEBRTC_OMX - encoder = OMXVideoCodec::CreateEncoder(OMXVideoCodec::CodecType::CODEC_H264); + encoder = OMXVideoCodec::CreateEncoder( + OMXVideoCodec::CodecType::CODEC_H264); #else - encoder = mozilla::GmpVideoCodec::CreateEncoder(); + encoder = mozilla::GmpVideoCodec::CreateEncoder(); #endif if (encoder) { return conduit->SetExternalSendCodec(config, encoder); @@ -2310,15 +2311,16 @@ int vcmGetH264SupportedPacketizationModes() */ uint32_t vcmGetVideoH264ProfileLevelID() { - // For OMX, constrained baseline level 1.2 (via a pref) + // constrained baseline level 1.2 + // XXX make variable based on openh264 and OMX support +#ifdef MOZ_WEBRTC_OMX // Max resolution CIF; we should include max-mbps - int32_t level = 13; // minimum suggested for WebRTC spec - - vcmGetVideoLevel(0, &level); - level &= 0xFF; - level |= 0x42E000; - - return (uint32_t) level; + return 0x42E00C; +#else + // XXX See bug 1043515 - we may want to support a higher profile than + // 1.3, depending on hardware(?) + return 0x42E00D; +#endif } /** @@ -2784,13 +2786,6 @@ static short vcmGetVideoPref(uint16_t codec, return VCM_ERROR; } -short vcmGetVideoLevel(uint16_t codec, - int32_t *level) { - return vcmGetVideoPref(codec, - "media.navigator.video.h264.level", - level); -} - short vcmGetVideoMaxFs(uint16_t codec, int32_t *max_fs) { return vcmGetVideoPref(codec, diff --git a/media/webrtc/signaling/src/sipcc/include/vcm.h b/media/webrtc/signaling/src/sipcc/include/vcm.h index f23dff72012..4b498e22a96 100755 --- a/media/webrtc/signaling/src/sipcc/include/vcm.h +++ b/media/webrtc/signaling/src/sipcc/include/vcm.h @@ -1083,11 +1083,14 @@ int vcmOnSdpParseError(const char *peercconnection, const char *message); */ int vcmDisableRtcpComponent(const char *peerconnection, int level); -short vcmGetVideoLevel(uint16_t codec, int32_t *level); short vcmGetVideoMaxFs(uint16_t codec, int32_t *max_fs); + short vcmGetVideoMaxFr(uint16_t codec, int32_t *max_fr); + short vcmGetVideoMaxBr(uint16_t codec, int32_t *max_br); + short vcmGetVideoMaxMbps(uint16_t codec, int32_t *max_mbps); + short vcmGetVideoPreferredCodec(int32_t *preferred_codec); //Using C++ for gips. This is the end of extern "C" above. diff --git a/media/webrtc/trunk/webrtc/modules/video_coding/main/source/content_metrics_processing.cc b/media/webrtc/trunk/webrtc/modules/video_coding/main/source/content_metrics_processing.cc index 3e8b2ec963a..757ffb0e46f 100644 --- a/media/webrtc/trunk/webrtc/modules/video_coding/main/source/content_metrics_processing.cc +++ b/media/webrtc/trunk/webrtc/modules/video_coding/main/source/content_metrics_processing.cc @@ -77,16 +77,7 @@ int VCMContentMetricsProcessing::UpdateContentData( if (contentMetrics == NULL) { return VCM_OK; } -#if defined(WEBRTC_GONK) - // "average" values that should yield kDefault in qm_select.cc - contentMetrics->motion_magnitude = 0.05f; - contentMetrics->spatial_pred_err = 0.03f; - contentMetrics->spatial_pred_err_h = 0.03f; - contentMetrics->spatial_pred_err_v = 0.03f; - return VCM_OK; -#else return ProcessContent(contentMetrics); -#endif } int VCMContentMetricsProcessing::ProcessContent( diff --git a/media/webrtc/trunk/webrtc/modules/video_coding/main/source/qm_select.cc b/media/webrtc/trunk/webrtc/modules/video_coding/main/source/qm_select.cc index cd36fc059b1..72f408beee3 100644 --- a/media/webrtc/trunk/webrtc/modules/video_coding/main/source/qm_select.cc +++ b/media/webrtc/trunk/webrtc/modules/video_coding/main/source/qm_select.cc @@ -60,10 +60,6 @@ void VCMQmMethod::UpdateContent(const VideoContentMetrics* contentMetrics) { } void VCMQmMethod::ComputeMotionNFD() { -#if defined(WEBRTC_GONK) - motion_.value = (kHighMotionNfd + kLowMotionNfd)/2; - motion_.level = kDefault; -#else if (content_metrics_) { motion_.value = content_metrics_->motion_magnitude; } @@ -75,15 +71,9 @@ void VCMQmMethod::ComputeMotionNFD() { } else { motion_.level = kDefault; } -#endif } void VCMQmMethod::ComputeSpatial() { -#if defined(WEBRTC_GONK) - float scale2 = image_type_ > kVGA ? kScaleTexture : 1.0; - spatial_.value = (kHighTexture + kLowTexture)*scale2/2; - spatial_.level = kDefault; -#else float spatial_err = 0.0; float spatial_err_h = 0.0; float spatial_err_v = 0.0; @@ -105,7 +95,6 @@ void VCMQmMethod::ComputeSpatial() { } else { spatial_.level = kDefault; } -#endif } ImageType VCMQmMethod::GetImageType(uint16_t width, diff --git a/media/webrtc/trunk/webrtc/modules/video_processing/main/source/content_analysis.cc b/media/webrtc/trunk/webrtc/modules/video_processing/main/source/content_analysis.cc index 6d777116239..981e0e606a8 100644 --- a/media/webrtc/trunk/webrtc/modules/video_processing/main/source/content_analysis.cc +++ b/media/webrtc/trunk/webrtc/modules/video_processing/main/source/content_analysis.cc @@ -58,7 +58,6 @@ VideoContentMetrics* VPMContentAnalysis::ComputeContentMetrics( if (VPM_OK != Initialize(inputFrame.width(), inputFrame.height())) return NULL; } -#if !defined(WEBRTC_GONK) // Compute motion metrics if (ca_Init_) { // Only interested in the Y plane. @@ -76,7 +75,6 @@ VideoContentMetrics* VPMContentAnalysis::ComputeContentMetrics( first_frame_ = false; } -#endif return ContentMetrics(); } @@ -125,12 +123,10 @@ int32_t VPMContentAnalysis::Initialize(int width, int height) { return VPM_MEMORY; } -#if !defined(WEBRTC_GONK) prev_frame_.reset(new uint8_t[width_ * height_]); // Y only. if (!prev_frame_) { return VPM_MEMORY; } -#endif // ok, all initialized ca_Init_ = true; diff --git a/media/webrtc/trunk/webrtc/video_engine/vie_encoder.cc b/media/webrtc/trunk/webrtc/video_engine/vie_encoder.cc index 6f3550708a9..2c877f9ff4f 100644 --- a/media/webrtc/trunk/webrtc/video_engine/vie_encoder.cc +++ b/media/webrtc/trunk/webrtc/video_engine/vie_encoder.cc @@ -705,8 +705,7 @@ void ViEEncoder::DeliverFrame(int id, return; } #endif - if (vcm_.AddVideoFrame(*decimated_frame, - vpm_.ContentMetrics()) != VCM_OK) { + if (vcm_.AddVideoFrame(*decimated_frame) != VCM_OK) { WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_, channel_id_), diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 3e9a7d9d4f7..21a5ba01b5f 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -303,7 +303,6 @@ pref("media.peerconnection.enabled", true); pref("media.peerconnection.video.enabled", true); pref("media.navigator.video.max_fs", 1200); // 640x480 == 1200mb pref("media.navigator.video.max_fr", 30); -pref("media.navigator.video.h264.level", 12); // 0x42E00C - level 1.2 pref("media.navigator.video.h264.max_br", 700); // 8x10 pref("media.navigator.video.h264.max_mbps", 11880); // CIF@30fps pref("media.peerconnection.video.h264_enabled", false); @@ -315,7 +314,6 @@ pref("media.peerconnection.enabled", true); pref("media.peerconnection.video.enabled", true); pref("media.navigator.video.max_fs", 0); // unrestricted pref("media.navigator.video.max_fr", 0); // unrestricted -pref("media.navigator.video.h264.level", 31); // 0x42E01f - level 3.1 pref("media.navigator.video.h264.max_br", 0); pref("media.navigator.video.h264.max_mbps", 0); pref("media.peerconnection.video.h264_enabled", false); @@ -373,12 +371,7 @@ pref("media.navigator.enabled", true); #endif pref("media.getusermedia.screensharing.enabled", true); -#ifdef RELEASE_BUILD pref("media.getusermedia.screensharing.allowed_domains", ""); -#else - // temporary value, not intended for release - bug 1049087 -pref("media.getusermedia.screensharing.allowed_domains", "mozilla.github.io"); -#endif // OS/X 10.6 and XP have screen/window sharing off by default due to various issues - Caveat emptor pref("media.getusermedia.screensharing.allow_on_old_platforms", false);