Pass selected cricket::VideoCodec down to internal H264 encoder

Pass the selected cricket::VideoCodec to H264EncoderImpl::H264EncoderImpl. The cricket::VideoCodec contains relevant information for H264 about selected profile and packetization mode.

BUG=chromium:600254,webrtc:6402, webrtc:6337

Review-Url: https://codereview.webrtc.org/2474993002
Cr-Commit-Position: refs/heads/master@{#15270}
This commit is contained in:
magjed 2016-11-28 07:20:21 -08:00 committed by Commit bot
parent 20dce34578
commit ceecea4559
9 changed files with 14 additions and 17 deletions

View File

@ -69,7 +69,7 @@ webrtc::VideoEncoder* InternalEncoderFactory::CreateVideoEncoder(
.value_or(webrtc::kVideoCodecUnknown);
switch (codec_type) {
case webrtc::kVideoCodecH264:
return webrtc::H264Encoder::Create();
return webrtc::H264Encoder::Create(codec);
case webrtc::kVideoCodecVP8:
return webrtc::VP8Encoder::Create();
case webrtc::kVideoCodecVP9:

View File

@ -66,6 +66,7 @@ if (rtc_include_tests) {
deps = [
"..:webrtc_common",
"../common_video",
"../media:rtc_media_base",
"../modules/audio_coding",
"../modules/audio_coding:audio_format_conversion",
"../modules/rtp_rtcp",

View File

@ -4,6 +4,7 @@ include_rules = [
"+vpx",
"+webrtc/base",
"+webrtc/common_video",
"+webrtc/media/base",
"+webrtc/system_wrappers",
"+webrtc/tools",
]

View File

@ -44,7 +44,7 @@ bool IsH264CodecSupported() {
#endif
}
H264Encoder* H264Encoder::Create() {
H264Encoder* H264Encoder::Create(const cricket::VideoCodec& codec) {
RTC_DCHECK(H264Encoder::IsSupported());
#if defined(WEBRTC_USE_H264)
RTC_CHECK(g_rtc_use_h264);

View File

@ -12,16 +12,7 @@
#ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_INCLUDE_H264_H_
#define WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_INCLUDE_H264_H_
#if defined(WEBRTC_IOS) || defined(WEBRTC_MAC)
#include <Availability.h>
#if defined(WEBRTC_IOS) || \
defined(__MAC_10_8) && __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_8
#define WEBRTC_VIDEO_TOOLBOX_SUPPORTED 1
#endif
#endif // defined(WEBRTC_IOS) || defined(WEBRTC_MAC)
#include "webrtc/media/base/codec.h"
#include "webrtc/modules/video_coding/include/video_codec_interface.h"
namespace webrtc {
@ -34,7 +25,7 @@ void DisableRtcUseH264();
class H264Encoder : public VideoEncoder {
public:
static H264Encoder* Create();
static H264Encoder* Create(const cricket::VideoCodec& codec);
// If H.264 is supported (any implementation).
static bool IsSupported();

View File

@ -155,7 +155,7 @@ class VideoProcessorIntegrationTest : public testing::Test {
void SetUpCodecConfig() {
if (codec_type_ == kVideoCodecH264) {
encoder_ = H264Encoder::Create();
encoder_ = H264Encoder::Create(cricket::VideoCodec("H264"));
decoder_ = H264Decoder::Create();
VideoCodingModule::Codec(kVideoCodecH264, &codec_settings_);
} else if (codec_type_ == kVideoCodecVP8) {

View File

@ -83,6 +83,7 @@ if (rtc_include_tests) {
"video_quality_test.h",
]
deps = [
"../media:rtc_media_base",
"../system_wrappers",
"//testing/gtest",
]
@ -162,6 +163,7 @@ if (rtc_include_tests) {
]
deps = [
":video",
"../media:rtc_media_base",
"//testing/gmock",
"//testing/gtest",
]

View File

@ -374,13 +374,15 @@ TEST_F(EndToEndTest, SendsAndReceivesVP9VideoRotation90) {
#if defined(WEBRTC_USE_H264)
TEST_F(EndToEndTest, SendsAndReceivesH264) {
CodecObserver test(500, kVideoRotation_0, "H264", H264Encoder::Create(),
CodecObserver test(500, kVideoRotation_0, "H264",
H264Encoder::Create(cricket::VideoCodec("H264")),
H264Decoder::Create());
RunBaseTest(&test);
}
TEST_F(EndToEndTest, SendsAndReceivesH264VideoRotation90) {
CodecObserver test(5, kVideoRotation_90, "H264", H264Encoder::Create(),
CodecObserver test(5, kVideoRotation_90, "H264",
H264Encoder::Create(cricket::VideoCodec("H264")),
H264Decoder::Create());
RunBaseTest(&test);
}

View File

@ -1009,7 +1009,7 @@ void VideoQualityTest::SetupVideo(Transport* send_transport,
int payload_type;
if (params_.video.codec == "H264") {
video_encoder_.reset(H264Encoder::Create());
video_encoder_.reset(H264Encoder::Create(cricket::VideoCodec("H264")));
payload_type = kPayloadTypeH264;
} else if (params_.video.codec == "VP8") {
video_encoder_.reset(VP8Encoder::Create());