Move h264_profile_level_id and vp9_profile to api/video_codecs

This is a refactor to simplify a follow-up CL of adding
SdpVideoFormat::IsSameCodec.

The original files media/base/h264_profile_level_id.* and
media/base/vp9_profile.h must be kept until downstream projects
stop using them.

Bug: chroimium:1187565
Change-Id: Ib39eca095a3d61939a914d9bffaf4b891ddd222f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215236
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Johannes Kron <kron@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33782}
This commit is contained in:
Johannes Kron
2021-04-19 09:09:26 +02:00
committed by Commit Bot
parent 8546666cb9
commit c3fcee7c3a
48 changed files with 1236 additions and 1051 deletions

View File

@ -45,11 +45,11 @@ bool IsH264CodecSupported() {
} // namespace
SdpVideoFormat CreateH264Format(H264::Profile profile,
H264::Level level,
SdpVideoFormat CreateH264Format(H264Profile profile,
H264Level level,
const std::string& packetization_mode) {
const absl::optional<std::string> profile_string =
H264::ProfileLevelIdToString(H264::ProfileLevelId(profile, level));
H264ProfileLevelIdToString(H264ProfileLevelId(profile, level));
RTC_CHECK(profile_string);
return SdpVideoFormat(
cricket::kH264CodecName,
@ -76,12 +76,14 @@ std::vector<SdpVideoFormat> SupportedH264Codecs() {
//
// We support both packetization modes 0 (mandatory) and 1 (optional,
// preferred).
return {
CreateH264Format(H264::kProfileBaseline, H264::kLevel3_1, "1"),
CreateH264Format(H264::kProfileBaseline, H264::kLevel3_1, "0"),
CreateH264Format(H264::kProfileConstrainedBaseline, H264::kLevel3_1, "1"),
CreateH264Format(H264::kProfileConstrainedBaseline, H264::kLevel3_1,
"0")};
return {CreateH264Format(H264Profile::kProfileBaseline, H264Level::kLevel3_1,
"1"),
CreateH264Format(H264Profile::kProfileBaseline, H264Level::kLevel3_1,
"0"),
CreateH264Format(H264Profile::kProfileConstrainedBaseline,
H264Level::kLevel3_1, "1"),
CreateH264Format(H264Profile::kProfileConstrainedBaseline,
H264Level::kLevel3_1, "0")};
}
std::unique_ptr<H264Encoder> H264Encoder::Create(

View File

@ -27,8 +27,8 @@ struct SdpVideoFormat;
// Creates an H264 SdpVideoFormat entry with specified paramters.
RTC_EXPORT SdpVideoFormat
CreateH264Format(H264::Profile profile,
H264::Level level,
CreateH264Format(H264Profile profile,
H264Level level,
const std::string& packetization_mode);
// Set to disable the H.264 encoder/decoder implementations that are provided if

View File

@ -25,12 +25,12 @@
#include "api/array_view.h"
#include "api/transport/field_trial_based_config.h"
#include "api/video/video_bitrate_allocation.h"
#include "api/video_codecs/h264_profile_level_id.h"
#include "api/video_codecs/sdp_video_format.h"
#include "api/video_codecs/video_codec.h"
#include "api/video_codecs/video_decoder.h"
#include "api/video_codecs/video_encoder_config.h"
#include "common_video/h264/h264_common.h"
#include "media/base/h264_profile_level_id.h"
#include "media/base/media_constants.h"
#include "media/engine/internal_decoder_factory.h"
#include "media/engine/internal_encoder_factory.h"
@ -302,11 +302,11 @@ std::string VideoCodecTestFixtureImpl::Config::CodecName() const {
name = CodecTypeToPayloadString(codec_settings.codecType);
}
if (codec_settings.codecType == kVideoCodecH264) {
if (h264_codec_settings.profile == H264::kProfileConstrainedHigh) {
if (h264_codec_settings.profile == H264Profile::kProfileConstrainedHigh) {
return name + "-CHP";
} else {
RTC_DCHECK_EQ(h264_codec_settings.profile,
H264::kProfileConstrainedBaseline);
H264Profile::kProfileConstrainedBaseline);
return name + "-CBP";
}
}
@ -613,8 +613,8 @@ bool VideoCodecTestFixtureImpl::CreateEncoderAndDecoder() {
? "1"
: "0";
params = {{cricket::kH264FmtpProfileLevelId,
*H264::ProfileLevelIdToString(H264::ProfileLevelId(
config_.h264_codec_settings.profile, H264::kLevel3_1))},
*H264ProfileLevelIdToString(H264ProfileLevelId(
config_.h264_codec_settings.profile, H264Level::kLevel3_1))},
{cricket::kH264FmtpPacketizationMode, packetization_mode}};
} else {
params = {};

View File

@ -95,7 +95,7 @@ TEST(VideoCodecTestMediaCodec, DISABLED_ForemanCif500kbpsH264CHP) {
const auto frame_checker =
std::make_unique<VideoCodecTestFixtureImpl::H264KeyframeChecker>();
config.h264_codec_settings.profile = H264::kProfileConstrainedHigh;
config.h264_codec_settings.profile = H264Profile::kProfileConstrainedHigh;
config.encoded_frame_checker = frame_checker.get();
config.SetCodecSettings(cricket::kH264CodecName, 1, 1, 1, false, false, false,
352, 288);

View File

@ -71,7 +71,7 @@ MAYBE_TEST(VideoCodecTestVideoToolbox, ForemanCif500kbpsH264CHP) {
const auto frame_checker =
std::make_unique<VideoCodecTestFixtureImpl::H264KeyframeChecker>();
auto config = CreateConfig();
config.h264_codec_settings.profile = H264::kProfileConstrainedHigh;
config.h264_codec_settings.profile = H264Profile::kProfileConstrainedHigh;
config.SetCodecSettings(cricket::kH264CodecName, 1, 1, 1, false, false, false,
352, 288);
config.encoded_frame_checker = frame_checker.get();

View File

@ -21,8 +21,8 @@
#include "api/fec_controller_override.h"
#include "api/transport/webrtc_key_value_config.h"
#include "api/video_codecs/video_encoder.h"
#include "api/video_codecs/vp9_profile.h"
#include "common_video/include/video_frame_buffer_pool.h"
#include "media/base/vp9_profile.h"
#include "modules/video_coding/codecs/interface/libvpx_interface.h"
#include "modules/video_coding/codecs/vp9/include/vp9.h"
#include "modules/video_coding/codecs/vp9/vp9_frame_buffer_pool.h"

View File

@ -15,8 +15,8 @@
#include "api/video/color_space.h"
#include "api/video/i420_buffer.h"
#include "api/video_codecs/video_encoder.h"
#include "api/video_codecs/vp9_profile.h"
#include "common_video/libyuv/include/webrtc_libyuv.h"
#include "media/base/vp9_profile.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "modules/video_coding/codecs/interface/libvpx_interface.h"
#include "modules/video_coding/codecs/interface/mock_libvpx_interface.h"

View File

@ -14,7 +14,7 @@
#include "api/transport/field_trial_based_config.h"
#include "api/video_codecs/sdp_video_format.h"
#include "media/base/vp9_profile.h"
#include "api/video_codecs/vp9_profile.h"
#include "modules/video_coding/codecs/vp9/libvpx_vp9_decoder.h"
#include "modules/video_coding/codecs/vp9/libvpx_vp9_encoder.h"
#include "rtc_base/checks.h"