зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1749047 - Implement plumbing for SVC. r=chunmin,webidl,smaug
Differential Revision: https://phabricator.services.mozilla.com/D196473
This commit is contained in:
Родитель
0f889104cd
Коммит
a690660c44
|
@ -174,7 +174,7 @@ already_AddRefed<MediaDataEncoder> CreateVideoEncoder(
|
|||
EncoderConfig(aCodec, gfx::IntSize{aWidth, aHeight}, aUsage, aPixelFormat,
|
||||
aPixelFormat, FRAME_RATE /* FPS */,
|
||||
KEYFRAME_INTERVAL /* keyframe interval */,
|
||||
BIT_RATE /* bitrate */, BIT_RATE_MODE, pref, aSpecific),
|
||||
BIT_RATE /* bitrate */, BIT_RATE_MODE, pref, MediaDataEncoder::ScalabilityMode::None, aSpecific),
|
||||
taskQueue);
|
||||
|
||||
return e.forget();
|
||||
|
|
|
@ -150,6 +150,7 @@ class MediaDataEncoder {
|
|||
};
|
||||
using PixelFormat = dom::ImageBitmapFormat;
|
||||
enum BitrateMode { Constant, Variable };
|
||||
enum ScalabilityMode { None, L1T2, L1T3 };
|
||||
|
||||
enum class HardwarePreference { RequireHardware, RequireSoftware, None };
|
||||
|
||||
|
@ -238,6 +239,7 @@ class EncoderConfig final {
|
|||
mHardwarePreference(aConfig.mHardwarePreference),
|
||||
mPixelFormat(aConfig.mPixelFormat),
|
||||
mSourcePixelFormat(aConfig.mSourcePixelFormat),
|
||||
mScalabilityMode(aConfig.mScalabilityMode),
|
||||
mFramerate(aConfig.mFramerate),
|
||||
mKeyframeInterval(aConfig.mKeyframeInterval),
|
||||
mBitrate(aConfig.mBitrate),
|
||||
|
@ -253,6 +255,7 @@ class EncoderConfig final {
|
|||
const uint32_t aBitrate,
|
||||
const MediaDataEncoder::BitrateMode aBitrateMode,
|
||||
const MediaDataEncoder::HardwarePreference aHardwarePreference,
|
||||
const MediaDataEncoder::ScalabilityMode aScalabilityMode,
|
||||
const Maybe<CodecSpecific>& aCodecSpecific)
|
||||
: mCodec(aCodecType),
|
||||
mSize(aSize),
|
||||
|
@ -260,6 +263,7 @@ class EncoderConfig final {
|
|||
mHardwarePreference(aHardwarePreference),
|
||||
mPixelFormat(aPixelFormat),
|
||||
mSourcePixelFormat(aSourcePixelFormat),
|
||||
mScalabilityMode(aScalabilityMode),
|
||||
mFramerate(aFramerate),
|
||||
mKeyframeInterval(aKeyframeInterval),
|
||||
mBitrate(aBitrate),
|
||||
|
@ -294,6 +298,7 @@ class EncoderConfig final {
|
|||
MediaDataEncoder::HardwarePreference mHardwarePreference;
|
||||
MediaDataEncoder::PixelFormat mPixelFormat;
|
||||
MediaDataEncoder::PixelFormat mSourcePixelFormat;
|
||||
MediaDataEncoder::ScalabilityMode mScalabilityMode;
|
||||
uint8_t mFramerate{};
|
||||
size_t mKeyframeInterval{};
|
||||
uint32_t mBitrate{};
|
||||
|
|
|
@ -250,13 +250,25 @@ EncoderConfig VideoEncoderConfigInternal::ToEncoderConfig() const {
|
|||
#endif
|
||||
specific.emplace(VP9Specific());
|
||||
}
|
||||
MediaDataEncoder::ScalabilityMode scalabilityMode;
|
||||
if (mScalabilityMode) {
|
||||
if (mScalabilityMode->EqualsLiteral("L1T2")) {
|
||||
scalabilityMode = MediaDataEncoder::ScalabilityMode::L1T2;
|
||||
} else if (mScalabilityMode->EqualsLiteral("L1T3")) {
|
||||
scalabilityMode = MediaDataEncoder::ScalabilityMode::L1T3;
|
||||
} else {
|
||||
scalabilityMode = MediaDataEncoder::ScalabilityMode::None;
|
||||
}
|
||||
} else {
|
||||
scalabilityMode = MediaDataEncoder::ScalabilityMode::None;
|
||||
}
|
||||
return EncoderConfig(
|
||||
codecType, {mWidth, mHeight}, usage, ImageBitmapFormat::RGBA32, ImageBitmapFormat::RGBA32,
|
||||
AssertedCast<uint8_t>(mFramerate.refOr(0.f)), 0, mBitrate.refOr(0),
|
||||
mBitrateMode == VideoEncoderBitrateMode::Constant
|
||||
? MediaDataEncoder::BitrateMode::Constant
|
||||
: MediaDataEncoder::BitrateMode::Variable,
|
||||
hwPref, specific);
|
||||
hwPref, scalabilityMode, specific);
|
||||
}
|
||||
already_AddRefed<WebCodecsConfigurationChangeList>
|
||||
VideoEncoderConfigInternal::Diff(
|
||||
|
@ -343,8 +355,10 @@ static bool CanEncode(const RefPtr<VideoEncoderConfigInternal>& aConfig) {
|
|||
|
||||
// Not supported
|
||||
if (aConfig->mScalabilityMode.isSome() &&
|
||||
!aConfig->mScalabilityMode->IsEmpty()) {
|
||||
LOGE("Scalability mode not supported");
|
||||
!aConfig->mScalabilityMode->EqualsLiteral("L1T2") &&
|
||||
!aConfig->mScalabilityMode->EqualsLiteral("L1T3")) {
|
||||
LOGE("Scalability mode %s not supported",
|
||||
NS_ConvertUTF16toUTF8(aConfig->mScalabilityMode.value()).get());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -291,7 +291,8 @@ already_AddRefed<MediaDataEncoder> WebrtcMediaDataEncoder::CreateEncoder(
|
|||
MediaDataEncoder::PixelFormat::YUV420P, aCodecSettings->maxFramerate,
|
||||
keyframeInterval, mBitrateAdjuster.GetTargetBitrateBps(),
|
||||
MediaDataEncoder::BitrateMode::Variable,
|
||||
MediaDataEncoder::HardwarePreference::None, specific);
|
||||
MediaDataEncoder::HardwarePreference::None,
|
||||
MediaDataEncoder::ScalabilityMode::None, specific);
|
||||
return mFactory->CreateEncoder(config, mTaskQueue);
|
||||
}
|
||||
|
||||
|
|
|
@ -110,13 +110,11 @@ dictionary VideoEncoderSupport {
|
|||
|
||||
dictionary EncodedVideoChunkMetadata {
|
||||
VideoDecoderConfig decoderConfig;
|
||||
// Not implemented https://bugzilla.mozilla.org/show_bug.cgi?id=1867066
|
||||
// SvcOutputMetadata svc;
|
||||
SvcOutputMetadata svc;
|
||||
// Not implemented https://bugzilla.mozilla.org/show_bug.cgi?id=1867067
|
||||
// BufferSource alphaSideData;
|
||||
};
|
||||
|
||||
// Not implemented https://bugzilla.mozilla.org/show_bug.cgi?id=1867066
|
||||
// dictionary SvcOutputMetadata {
|
||||
// unsigned long temporalLayerId;
|
||||
// };
|
||||
dictionary SvcOutputMetadata {
|
||||
unsigned long temporalLayerId;
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче