Reland "Handle scalability mode in QueryCodecSupport"

This reverts commit 74281bed5350af9c15f83e0b1aec5c5921dbf76f.

Reason for revert: Fixed unit test by removing VP9 profile 2 from encoder factory unit test since this is platform dependent.

Original change's description:
> Revert "Handle scalability mode in QueryCodecSupport"
>
> This reverts commit 715a14811883a642e3acca21fb6017f8a128c0a5.
>
> Reason for revert: Speculative revert. Breaks upstream project http://b/200009579
>
> Original change's description:
> > Handle scalability mode in QueryCodecSupport
> >
> > All valid scalability modes should be supported by the builtin
> > software decoder/encoder.
> >
> > Bug: chromium:1187565
> > Change-Id: If66105d210d5055019f35dae2f80a18ad4a70cdd
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/222642
> > Commit-Queue: Johannes Kron <kron@webrtc.org>
> > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
> > Reviewed-by: Erik Språng <sprang@webrtc.org>
> > Cr-Commit-Position: refs/heads/main@{#34998}
>
> TBR=danilchap@webrtc.org,sprang@webrtc.org,kron@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com
>
> Change-Id: Ibf40d523c50791d73e2afdc3917892b859d2bcb6
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:1187565
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/232020
> Reviewed-by: Andrey Logvin <landrey@webrtc.org>
> Commit-Queue: Andrey Logvin <landrey@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#35001}


Bug: chromium:1187565
Change-Id: I598a2a530b8fea22997bbb5910eb3b864d1e28a2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/232021
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Johannes Kron <kron@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35003}
This commit is contained in:
Johannes Kron
2021-09-15 10:56:04 +00:00
committed by WebRTC LUCI CQ
parent 9c1657cba8
commit b26863ed0c
18 changed files with 341 additions and 11 deletions

View File

@ -15,6 +15,7 @@
#include <memory>
#include <vector>
#include "absl/strings/string_view.h"
#include "api/video_codecs/sdp_video_format.h"
#include "media/base/codec.h"
#include "modules/video_coding/include/video_codec_interface.h"
@ -36,6 +37,7 @@ class VP9Encoder : public VideoEncoder {
static std::unique_ptr<VP9Encoder> Create();
// Parses VP9 Profile from `codec` and returns the appropriate implementation.
static std::unique_ptr<VP9Encoder> Create(const cricket::VideoCodec& codec);
static bool SupportsScalabilityMode(absl::string_view scalability_mode);
~VP9Encoder() override {}
};

View File

@ -23,6 +23,13 @@
#include "vpx/vpx_codec.h"
namespace webrtc {
namespace {
constexpr absl::string_view kSupportedScalabilityModes[] = {
"L1T2", "L1T3", "L2T1", "L2T2", "L2T3", "L3T1",
"L3T2", "L3T3", "L1T2h", "L1T3h", "L2T1h", "L2T2h",
"L2T3h", "L3T1h", "L3T2h", "L3T3h", "L2T2_KEY", "L2T3_KEY",
"L3T1_KEY", "L3T2_KEY", "L3T3_KEY"};
} // namespace
std::vector<SdpVideoFormat> SupportedVP9Codecs() {
#ifdef RTC_ENABLE_VP9
@ -86,6 +93,15 @@ std::unique_ptr<VP9Encoder> VP9Encoder::Create(
#endif
}
bool VP9Encoder::SupportsScalabilityMode(absl::string_view scalability_mode) {
for (const auto& entry : kSupportedScalabilityModes) {
if (entry == scalability_mode) {
return true;
}
}
return false;
}
std::unique_ptr<VP9Decoder> VP9Decoder::Create() {
#ifdef RTC_ENABLE_VP9
return std::make_unique<LibvpxVp9Decoder>();