Add VP9 profile negotiation to SDP
This CL adds VP9 profile information in SDP. It adds the necessary fields and enums to codec containers. Additional profiles will be followed. Bug: webrtc:9376 Change-Id: I78574714f06f8087262a71dd64c01f31a229dd54 Reviewed-on: https://webrtc-review.googlesource.com/81960 Reviewed-by: Taylor (left Google) <deadbeef@webrtc.org> Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> Reviewed-by: Rasmus Brandt <brandtr@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Commit-Queue: Emircan Uysaler <emircan@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23810}
This commit is contained in:
committed by
Commit Bot
parent
0ea751539e
commit
98badbcd9f
3
modules/video_coding/codecs/vp9/DEPS
Normal file
3
modules/video_coding/codecs/vp9/DEPS
Normal file
@ -0,0 +1,3 @@
|
||||
include_rules = [
|
||||
"+media/base",
|
||||
]
|
||||
@ -13,22 +13,31 @@
|
||||
#define MODULES_VIDEO_CODING_CODECS_VP9_INCLUDE_VP9_H_
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "api/video_codecs/sdp_video_format.h"
|
||||
#include "media/base/codec.h"
|
||||
#include "modules/video_coding/include/video_codec_interface.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
// Returns a vector with all supported internal VP9 profiles that we can
|
||||
// negotiate in SDP, in order of preference.
|
||||
std::vector<SdpVideoFormat> SupportedVP9Codecs();
|
||||
|
||||
class VP9Encoder : public VideoEncoder {
|
||||
public:
|
||||
static bool IsSupported();
|
||||
// Deprecated. Returns default implementation using VP9 Profile 0.
|
||||
// TODO(emircan): Remove once this is no longer used.
|
||||
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);
|
||||
|
||||
~VP9Encoder() override {}
|
||||
};
|
||||
|
||||
class VP9Decoder : public VideoDecoder {
|
||||
public:
|
||||
static bool IsSupported();
|
||||
static std::unique_ptr<VP9Decoder> Create();
|
||||
|
||||
~VP9Decoder() override {}
|
||||
|
||||
@ -52,12 +52,19 @@ int GetCpuSpeed(int width, int height) {
|
||||
#endif
|
||||
}
|
||||
|
||||
bool VP9Encoder::IsSupported() {
|
||||
return true;
|
||||
std::vector<SdpVideoFormat> SupportedVP9Codecs() {
|
||||
return {SdpVideoFormat(
|
||||
cricket::kVp9CodecName,
|
||||
{{kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile0)}})};
|
||||
}
|
||||
|
||||
std::unique_ptr<VP9Encoder> VP9Encoder::Create() {
|
||||
return rtc::MakeUnique<VP9EncoderImpl>();
|
||||
return rtc::MakeUnique<VP9EncoderImpl>(cricket::VideoCodec());
|
||||
}
|
||||
|
||||
std::unique_ptr<VP9Encoder> VP9Encoder::Create(
|
||||
const cricket::VideoCodec& codec) {
|
||||
return rtc::MakeUnique<VP9EncoderImpl>(codec);
|
||||
}
|
||||
|
||||
void VP9EncoderImpl::EncoderOutputCodedPacketCallback(vpx_codec_cx_pkt* pkt,
|
||||
@ -66,9 +73,11 @@ void VP9EncoderImpl::EncoderOutputCodedPacketCallback(vpx_codec_cx_pkt* pkt,
|
||||
enc->GetEncodedLayerFrame(pkt);
|
||||
}
|
||||
|
||||
VP9EncoderImpl::VP9EncoderImpl()
|
||||
VP9EncoderImpl::VP9EncoderImpl(const cricket::VideoCodec& codec)
|
||||
: encoded_image_(),
|
||||
encoded_complete_callback_(nullptr),
|
||||
profile_(
|
||||
ParseSdpForVP9Profile(codec.params).value_or(VP9Profile::kProfile0)),
|
||||
inited_(false),
|
||||
timestamp_(0),
|
||||
cpu_speed_(3),
|
||||
@ -88,6 +97,7 @@ VP9EncoderImpl::VP9EncoderImpl()
|
||||
is_flexible_mode_(false) {
|
||||
memset(&codec_, 0, sizeof(codec_));
|
||||
memset(&svc_params_, 0, sizeof(vpx_svc_extra_cfg_t));
|
||||
RTC_DCHECK(VP9Profile::kProfile0 == profile_);
|
||||
}
|
||||
|
||||
VP9EncoderImpl::~VP9EncoderImpl() {
|
||||
@ -960,10 +970,6 @@ const char* VP9EncoderImpl::ImplementationName() const {
|
||||
return "libvpx";
|
||||
}
|
||||
|
||||
bool VP9Decoder::IsSupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::unique_ptr<VP9Decoder> VP9Decoder::Create() {
|
||||
return rtc::MakeUnique<VP9DecoderImpl>();
|
||||
}
|
||||
|
||||
@ -17,6 +17,8 @@
|
||||
#include <vector>
|
||||
|
||||
#include "modules/video_coding/codecs/vp9/include/vp9.h"
|
||||
|
||||
#include "media/base/vp9_profile.h"
|
||||
#include "modules/video_coding/codecs/vp9/vp9_frame_buffer_pool.h"
|
||||
#include "rtc_base/rate_statistics.h"
|
||||
|
||||
@ -28,7 +30,7 @@ namespace webrtc {
|
||||
|
||||
class VP9EncoderImpl : public VP9Encoder {
|
||||
public:
|
||||
VP9EncoderImpl();
|
||||
explicit VP9EncoderImpl(const cricket::VideoCodec& codec);
|
||||
|
||||
virtual ~VP9EncoderImpl();
|
||||
|
||||
@ -94,6 +96,7 @@ class VP9EncoderImpl : public VP9Encoder {
|
||||
CodecSpecificInfo codec_specific_;
|
||||
EncodedImageCallback* encoded_complete_callback_;
|
||||
VideoCodec codec_;
|
||||
const VP9Profile profile_;
|
||||
bool inited_;
|
||||
int64_t timestamp_;
|
||||
int cpu_speed_;
|
||||
|
||||
@ -14,12 +14,14 @@
|
||||
#endif // !defined(RTC_DISABLE_VP9)
|
||||
|
||||
#include "modules/video_coding/codecs/vp9/include/vp9.h"
|
||||
|
||||
#include "api/video_codecs/sdp_video_format.h"
|
||||
#include "rtc_base/checks.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
bool VP9Encoder::IsSupported() {
|
||||
return false;
|
||||
std::vector<SdpVideoFormat> SupportedVP9Codecs() {
|
||||
return std::vector<SdpVideoFormat>();
|
||||
}
|
||||
|
||||
std::unique_ptr<VP9Encoder> VP9Encoder::Create() {
|
||||
@ -27,8 +29,10 @@ std::unique_ptr<VP9Encoder> VP9Encoder::Create() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool VP9Decoder::IsSupported() {
|
||||
return false;
|
||||
std::unique_ptr<VP9Encoder> VP9Encoder::Create(
|
||||
const cricket::VideoCodec& codec) {
|
||||
RTC_NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<VP9Decoder> VP9Decoder::Create() {
|
||||
|
||||
Reference in New Issue
Block a user