зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1726617 - p1: use video encoder fallback wrapper in WebRTC. r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D126975
This commit is contained in:
Родитель
a39c65797b
Коммит
82dec2aaad
|
@ -13,6 +13,7 @@
|
||||||
// libwebrtc includes
|
// libwebrtc includes
|
||||||
#include "api/rtp_headers.h"
|
#include "api/rtp_headers.h"
|
||||||
#include "api/video_codecs/video_codec.h"
|
#include "api/video_codecs/video_codec.h"
|
||||||
|
#include "api/video_codecs/video_encoder_software_fallback_wrapper.h"
|
||||||
#include "media/engine/encoder_simulcast_proxy.h"
|
#include "media/engine/encoder_simulcast_proxy.h"
|
||||||
#include "modules/video_coding/codecs/vp8/include/vp8.h"
|
#include "modules/video_coding/codecs/vp8/include/vp8.h"
|
||||||
#include "modules/video_coding/codecs/vp9/include/vp9.h"
|
#include "modules/video_coding/codecs/vp9/include/vp9.h"
|
||||||
|
@ -92,13 +93,15 @@ std::unique_ptr<webrtc::VideoEncoder>
|
||||||
WebrtcVideoEncoderFactory::InternalFactory::CreateVideoEncoder(
|
WebrtcVideoEncoderFactory::InternalFactory::CreateVideoEncoder(
|
||||||
const webrtc::SdpVideoFormat& aFormat) {
|
const webrtc::SdpVideoFormat& aFormat) {
|
||||||
MOZ_ASSERT(Supports(aFormat));
|
MOZ_ASSERT(Supports(aFormat));
|
||||||
std::unique_ptr<webrtc::VideoEncoder> encoder;
|
|
||||||
|
|
||||||
encoder.reset(MediaDataCodec::CreateEncoder(aFormat));
|
std::unique_ptr<webrtc::VideoEncoder> platformEncoder;
|
||||||
if (encoder) {
|
platformEncoder.reset(MediaDataCodec::CreateEncoder(aFormat));
|
||||||
return encoder;
|
const bool fallback = StaticPrefs::media_webrtc_software_encoder_fallback();
|
||||||
|
if (!fallback && platformEncoder) {
|
||||||
|
return platformEncoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<webrtc::VideoEncoder> encoder;
|
||||||
switch (webrtc::PayloadStringToCodecType(aFormat.name)) {
|
switch (webrtc::PayloadStringToCodecType(aFormat.name)) {
|
||||||
case webrtc::VideoCodecType::kVideoCodecH264: {
|
case webrtc::VideoCodecType::kVideoCodecH264: {
|
||||||
// get an external encoder
|
// get an external encoder
|
||||||
|
@ -121,6 +124,13 @@ WebrtcVideoEncoderFactory::InternalFactory::CreateVideoEncoder(
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (fallback && encoder && platformEncoder) {
|
||||||
|
return webrtc::CreateVideoEncoderSoftwareFallbackWrapper(
|
||||||
|
std::move(encoder), std::move(platformEncoder), false);
|
||||||
|
}
|
||||||
|
if (platformEncoder) {
|
||||||
|
return platformEncoder;
|
||||||
|
}
|
||||||
return encoder;
|
return encoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8935,6 +8935,15 @@
|
||||||
#endif
|
#endif
|
||||||
mirror: always
|
mirror: always
|
||||||
|
|
||||||
|
- name: media.webrtc.software_encoder.fallback
|
||||||
|
type: RelaxedAtomicBool
|
||||||
|
#if defined(MOZ_WIDGET_ANDROID) || defined(NIGHTLY_BUILD)
|
||||||
|
value: true
|
||||||
|
#else
|
||||||
|
value: false
|
||||||
|
#endif
|
||||||
|
mirror: always
|
||||||
|
|
||||||
- name: media.block-autoplay-until-in-foreground
|
- name: media.block-autoplay-until-in-foreground
|
||||||
type: bool
|
type: bool
|
||||||
#if !defined(MOZ_WIDGET_ANDROID)
|
#if !defined(MOZ_WIDGET_ANDROID)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче