Remove VP8EncoderSimulcastProxy
The class has been renamed to EncoderSimulcastProxy. Bug: webrtc:10069 Change-Id: Ief03cfb27145798ac46692d9e51371d2e119eeb0 Reviewed-on: https://webrtc-review.googlesource.com/c/114551 Reviewed-by: Erik Språng <sprang@webrtc.org> Commit-Queue: Florent Castelli <orphis@webrtc.org> Cr-Commit-Position: refs/heads/master@{#26031}
This commit is contained in:

committed by
Commit Bot

parent
f7f753b320
commit
73f2da9fa7
@ -80,7 +80,6 @@ rtc_static_library("builtin_video_encoder_factory") {
|
|||||||
"../../media:rtc_encoder_simulcast_proxy",
|
"../../media:rtc_encoder_simulcast_proxy",
|
||||||
"../../media:rtc_internal_video_codecs",
|
"../../media:rtc_internal_video_codecs",
|
||||||
"../../media:rtc_media_base",
|
"../../media:rtc_media_base",
|
||||||
"../../media:rtc_vp8_encoder_simulcast_proxy",
|
|
||||||
"../../rtc_base:checks",
|
"../../rtc_base:checks",
|
||||||
"../../rtc_base:ptr_util",
|
"../../rtc_base:ptr_util",
|
||||||
"../../rtc_base/system:rtc_export",
|
"../../rtc_base/system:rtc_export",
|
||||||
|
@ -195,28 +195,6 @@ rtc_static_library("rtc_simulcast_encoder_adapter") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc_static_library("rtc_vp8_encoder_simulcast_proxy") {
|
|
||||||
visibility = [ "*" ]
|
|
||||||
defines = []
|
|
||||||
libs = []
|
|
||||||
sources = [
|
|
||||||
"engine/vp8_encoder_simulcast_proxy.cc",
|
|
||||||
"engine/vp8_encoder_simulcast_proxy.h",
|
|
||||||
]
|
|
||||||
deps = [
|
|
||||||
":rtc_simulcast_encoder_adapter",
|
|
||||||
"../:webrtc_common",
|
|
||||||
"../api/video:video_bitrate_allocation",
|
|
||||||
"../api/video:video_frame",
|
|
||||||
"../api/video_codecs:video_codecs_api",
|
|
||||||
"../modules/video_coding:video_codec_interface",
|
|
||||||
]
|
|
||||||
if (!build_with_chromium && is_clang) {
|
|
||||||
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
|
|
||||||
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rtc_static_library("rtc_encoder_simulcast_proxy") {
|
rtc_static_library("rtc_encoder_simulcast_proxy") {
|
||||||
visibility = [ "*" ]
|
visibility = [ "*" ]
|
||||||
defines = []
|
defines = []
|
||||||
@ -248,7 +226,6 @@ rtc_static_library("rtc_internal_video_codecs") {
|
|||||||
":rtc_encoder_simulcast_proxy",
|
":rtc_encoder_simulcast_proxy",
|
||||||
":rtc_h264_profile_id",
|
":rtc_h264_profile_id",
|
||||||
":rtc_simulcast_encoder_adapter",
|
":rtc_simulcast_encoder_adapter",
|
||||||
":rtc_vp8_encoder_simulcast_proxy",
|
|
||||||
"../:webrtc_common",
|
"../:webrtc_common",
|
||||||
"../api/video:encoded_image",
|
"../api/video:encoded_image",
|
||||||
"../api/video:video_frame",
|
"../api/video:video_frame",
|
||||||
@ -272,7 +249,6 @@ rtc_static_library("rtc_internal_video_codecs") {
|
|||||||
# TODO(bugs.webrtc.org/7925): stop exporting this header once downstream
|
# TODO(bugs.webrtc.org/7925): stop exporting this header once downstream
|
||||||
# targets depend on :rtc_encoder_simulcast_proxy directly.
|
# targets depend on :rtc_encoder_simulcast_proxy directly.
|
||||||
"engine/encoder_simulcast_proxy.h",
|
"engine/encoder_simulcast_proxy.h",
|
||||||
"engine/vp8_encoder_simulcast_proxy.h",
|
|
||||||
"engine/webrtcvideodecoderfactory.h",
|
"engine/webrtcvideodecoderfactory.h",
|
||||||
"engine/webrtcvideoencoderfactory.h",
|
"engine/webrtcvideoencoderfactory.h",
|
||||||
]
|
]
|
||||||
@ -625,7 +601,6 @@ if (rtc_include_tests) {
|
|||||||
"engine/payload_type_mapper_unittest.cc",
|
"engine/payload_type_mapper_unittest.cc",
|
||||||
"engine/simulcast_encoder_adapter_unittest.cc",
|
"engine/simulcast_encoder_adapter_unittest.cc",
|
||||||
"engine/simulcast_unittest.cc",
|
"engine/simulcast_unittest.cc",
|
||||||
"engine/vp8_encoder_simulcast_proxy_unittest.cc",
|
|
||||||
"engine/webrtcmediaengine_unittest.cc",
|
"engine/webrtcmediaengine_unittest.cc",
|
||||||
"engine/webrtcvideocapturer_unittest.cc",
|
"engine/webrtcvideocapturer_unittest.cc",
|
||||||
"engine/webrtcvideoencoderfactory_unittest.cc",
|
"engine/webrtcvideoencoderfactory_unittest.cc",
|
||||||
@ -677,7 +652,6 @@ if (rtc_include_tests) {
|
|||||||
":rtc_media_base",
|
":rtc_media_base",
|
||||||
":rtc_media_tests_utils",
|
":rtc_media_tests_utils",
|
||||||
":rtc_simulcast_encoder_adapter",
|
":rtc_simulcast_encoder_adapter",
|
||||||
":rtc_vp8_encoder_simulcast_proxy",
|
|
||||||
":rtc_vp9_profile",
|
":rtc_vp9_profile",
|
||||||
"../api:create_simulcast_test_fixture_api",
|
"../api:create_simulcast_test_fixture_api",
|
||||||
"../api:libjingle_peerconnection_api",
|
"../api:libjingle_peerconnection_api",
|
||||||
|
@ -1,69 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Use of this source code is governed by a BSD-style license
|
|
||||||
* that can be found in the LICENSE file in the root of the source
|
|
||||||
* tree. An additional intellectual property rights grant can be found
|
|
||||||
* in the file PATENTS. All contributing project authors may
|
|
||||||
* be found in the AUTHORS file in the root of the source tree.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "media/engine/vp8_encoder_simulcast_proxy.h"
|
|
||||||
|
|
||||||
#include "media/engine/simulcast_encoder_adapter.h"
|
|
||||||
#include "modules/video_coding/include/video_error_codes.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
|
||||||
VP8EncoderSimulcastProxy::VP8EncoderSimulcastProxy(VideoEncoderFactory* factory,
|
|
||||||
const SdpVideoFormat& format)
|
|
||||||
: factory_(factory), video_format_(format), callback_(nullptr) {
|
|
||||||
encoder_ = factory_->CreateVideoEncoder(format);
|
|
||||||
}
|
|
||||||
|
|
||||||
VP8EncoderSimulcastProxy::VP8EncoderSimulcastProxy(VideoEncoderFactory* factory)
|
|
||||||
: VP8EncoderSimulcastProxy(factory, SdpVideoFormat("VP8")) {}
|
|
||||||
|
|
||||||
VP8EncoderSimulcastProxy::~VP8EncoderSimulcastProxy() {}
|
|
||||||
|
|
||||||
int VP8EncoderSimulcastProxy::Release() {
|
|
||||||
return encoder_->Release();
|
|
||||||
}
|
|
||||||
|
|
||||||
int VP8EncoderSimulcastProxy::InitEncode(const VideoCodec* inst,
|
|
||||||
int number_of_cores,
|
|
||||||
size_t max_payload_size) {
|
|
||||||
int ret = encoder_->InitEncode(inst, number_of_cores, max_payload_size);
|
|
||||||
if (ret == WEBRTC_VIDEO_CODEC_ERR_SIMULCAST_PARAMETERS_NOT_SUPPORTED) {
|
|
||||||
encoder_.reset(new SimulcastEncoderAdapter(factory_, video_format_));
|
|
||||||
if (callback_) {
|
|
||||||
encoder_->RegisterEncodeCompleteCallback(callback_);
|
|
||||||
}
|
|
||||||
ret = encoder_->InitEncode(inst, number_of_cores, max_payload_size);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int VP8EncoderSimulcastProxy::Encode(
|
|
||||||
const VideoFrame& input_image,
|
|
||||||
const CodecSpecificInfo* codec_specific_info,
|
|
||||||
const std::vector<FrameType>* frame_types) {
|
|
||||||
return encoder_->Encode(input_image, codec_specific_info, frame_types);
|
|
||||||
}
|
|
||||||
|
|
||||||
int VP8EncoderSimulcastProxy::RegisterEncodeCompleteCallback(
|
|
||||||
EncodedImageCallback* callback) {
|
|
||||||
callback_ = callback;
|
|
||||||
return encoder_->RegisterEncodeCompleteCallback(callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
int VP8EncoderSimulcastProxy::SetRateAllocation(
|
|
||||||
const VideoBitrateAllocation& bitrate,
|
|
||||||
uint32_t new_framerate) {
|
|
||||||
return encoder_->SetRateAllocation(bitrate, new_framerate);
|
|
||||||
}
|
|
||||||
|
|
||||||
VideoEncoder::EncoderInfo VP8EncoderSimulcastProxy::GetEncoderInfo() const {
|
|
||||||
return encoder_->GetEncoderInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace webrtc
|
|
@ -1,66 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Use of this source code is governed by a BSD-style license
|
|
||||||
* that can be found in the LICENSE file in the root of the source
|
|
||||||
* tree. An additional intellectual property rights grant can be found
|
|
||||||
* in the file PATENTS. All contributing project authors may
|
|
||||||
* be found in the AUTHORS file in the root of the source tree.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef MEDIA_ENGINE_VP8_ENCODER_SIMULCAST_PROXY_H_
|
|
||||||
#define MEDIA_ENGINE_VP8_ENCODER_SIMULCAST_PROXY_H_
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <memory>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "api/video/video_bitrate_allocation.h"
|
|
||||||
#include "api/video/video_frame.h"
|
|
||||||
#include "api/video_codecs/sdp_video_format.h"
|
|
||||||
#include "api/video_codecs/video_codec.h"
|
|
||||||
#include "api/video_codecs/video_encoder.h"
|
|
||||||
#include "api/video_codecs/video_encoder_factory.h"
|
|
||||||
#include "common_types.h" // NOLINT(build/include)
|
|
||||||
#include "modules/video_coding/include/video_codec_interface.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
|
||||||
|
|
||||||
// This class provides fallback to SimulcastEncoderAdapter if default VP8Encoder
|
|
||||||
// doesn't support simulcast for provided settings.
|
|
||||||
// Deprecated: Use EncoderSimulcastProxy instead!
|
|
||||||
class VP8EncoderSimulcastProxy : public VideoEncoder {
|
|
||||||
public:
|
|
||||||
VP8EncoderSimulcastProxy(VideoEncoderFactory* factory,
|
|
||||||
const SdpVideoFormat& format);
|
|
||||||
// Deprecated. Remove once all clients use constructor with both factory and
|
|
||||||
// SdpVideoFormat;
|
|
||||||
explicit VP8EncoderSimulcastProxy(VideoEncoderFactory* factory);
|
|
||||||
|
|
||||||
~VP8EncoderSimulcastProxy() override;
|
|
||||||
|
|
||||||
// Implements VideoEncoder.
|
|
||||||
int Release() override;
|
|
||||||
int InitEncode(const VideoCodec* inst,
|
|
||||||
int number_of_cores,
|
|
||||||
size_t max_payload_size) override;
|
|
||||||
int Encode(const VideoFrame& input_image,
|
|
||||||
const CodecSpecificInfo* codec_specific_info,
|
|
||||||
const std::vector<FrameType>* frame_types) override;
|
|
||||||
int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override;
|
|
||||||
int SetRateAllocation(const VideoBitrateAllocation& bitrate,
|
|
||||||
uint32_t new_framerate) override;
|
|
||||||
EncoderInfo GetEncoderInfo() const override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
VideoEncoderFactory* const factory_;
|
|
||||||
SdpVideoFormat video_format_;
|
|
||||||
std::unique_ptr<VideoEncoder> encoder_;
|
|
||||||
EncodedImageCallback* callback_;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace webrtc
|
|
||||||
|
|
||||||
#endif // MEDIA_ENGINE_VP8_ENCODER_SIMULCAST_PROXY_H_
|
|
@ -1,242 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Use of this source code is governed by a BSD-style license
|
|
||||||
* that can be found in the LICENSE file in the root of the source
|
|
||||||
* tree. An additional intellectual property rights grant can be found
|
|
||||||
* in the file PATENTS. All contributing project authors may
|
|
||||||
* be found in the AUTHORS file in the root of the source tree.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "media/engine/vp8_encoder_simulcast_proxy.h"
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include "api/test/mock_video_encoder_factory.h"
|
|
||||||
#include "api/video_codecs/vp8_temporal_layers.h"
|
|
||||||
#include "media/engine/webrtcvideoencoderfactory.h"
|
|
||||||
#include "modules/video_coding/include/video_codec_interface.h"
|
|
||||||
#include "test/gmock.h"
|
|
||||||
#include "test/gtest.h"
|
|
||||||
#include "test/video_codec_settings.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
|
||||||
namespace testing {
|
|
||||||
|
|
||||||
using ::testing::Return;
|
|
||||||
using ::testing::_;
|
|
||||||
using ::testing::NiceMock;
|
|
||||||
|
|
||||||
class MockEncoder : public VideoEncoder {
|
|
||||||
public:
|
|
||||||
// TODO(nisse): Valid overrides commented out, because the gmock
|
|
||||||
// methods don't use any override declarations, and we want to avoid
|
|
||||||
// warnings from -Winconsistent-missing-override. See
|
|
||||||
// http://crbug.com/428099.
|
|
||||||
MockEncoder() {}
|
|
||||||
virtual ~MockEncoder() {}
|
|
||||||
|
|
||||||
MOCK_METHOD3(InitEncode,
|
|
||||||
int32_t(const VideoCodec* codec_settings,
|
|
||||||
int32_t number_of_cores,
|
|
||||||
size_t max_payload_size));
|
|
||||||
|
|
||||||
MOCK_METHOD1(RegisterEncodeCompleteCallback, int32_t(EncodedImageCallback*));
|
|
||||||
|
|
||||||
MOCK_METHOD0(Release, int32_t());
|
|
||||||
|
|
||||||
MOCK_METHOD3(
|
|
||||||
Encode,
|
|
||||||
int32_t(const VideoFrame& inputImage,
|
|
||||||
const CodecSpecificInfo* codecSpecificInfo,
|
|
||||||
const std::vector<FrameType>* frame_types) /* override */);
|
|
||||||
|
|
||||||
MOCK_CONST_METHOD0(GetEncoderInfo, VideoEncoder::EncoderInfo(void));
|
|
||||||
};
|
|
||||||
|
|
||||||
TEST(VP8EncoderSimulcastProxy, ChoosesCorrectImplementation) {
|
|
||||||
const std::string kImplementationName = "Fake";
|
|
||||||
const std::string kSimulcastAdaptedImplementationName =
|
|
||||||
"SimulcastEncoderAdapter (Fake, Fake, Fake)";
|
|
||||||
VideoCodec codec_settings;
|
|
||||||
webrtc::test::CodecSettings(kVideoCodecVP8, &codec_settings);
|
|
||||||
codec_settings.simulcastStream[0] = {test::kTestWidth,
|
|
||||||
test::kTestHeight,
|
|
||||||
test::kTestFrameRate,
|
|
||||||
2,
|
|
||||||
2000,
|
|
||||||
1000,
|
|
||||||
1000,
|
|
||||||
56};
|
|
||||||
codec_settings.simulcastStream[1] = {test::kTestWidth,
|
|
||||||
test::kTestHeight,
|
|
||||||
test::kTestFrameRate,
|
|
||||||
2,
|
|
||||||
3000,
|
|
||||||
1000,
|
|
||||||
1000,
|
|
||||||
56};
|
|
||||||
codec_settings.simulcastStream[2] = {test::kTestWidth,
|
|
||||||
test::kTestHeight,
|
|
||||||
test::kTestFrameRate,
|
|
||||||
2,
|
|
||||||
5000,
|
|
||||||
1000,
|
|
||||||
1000,
|
|
||||||
56};
|
|
||||||
codec_settings.numberOfSimulcastStreams = 3;
|
|
||||||
|
|
||||||
NiceMock<MockEncoder>* mock_encoder = new NiceMock<MockEncoder>();
|
|
||||||
NiceMock<MockVideoEncoderFactory> simulcast_factory;
|
|
||||||
|
|
||||||
EXPECT_CALL(*mock_encoder, InitEncode(_, _, _))
|
|
||||||
.WillOnce(Return(WEBRTC_VIDEO_CODEC_OK));
|
|
||||||
VideoEncoder::EncoderInfo encoder_info;
|
|
||||||
encoder_info.implementation_name = kImplementationName;
|
|
||||||
EXPECT_CALL(*mock_encoder, GetEncoderInfo())
|
|
||||||
.WillRepeatedly(Return(encoder_info));
|
|
||||||
|
|
||||||
EXPECT_CALL(simulcast_factory, CreateVideoEncoderProxy(_))
|
|
||||||
.Times(1)
|
|
||||||
.WillOnce(Return(mock_encoder));
|
|
||||||
|
|
||||||
VP8EncoderSimulcastProxy simulcast_enabled_proxy(&simulcast_factory,
|
|
||||||
SdpVideoFormat("VP8"));
|
|
||||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
||||||
simulcast_enabled_proxy.InitEncode(&codec_settings, 4, 1200));
|
|
||||||
EXPECT_EQ(kImplementationName,
|
|
||||||
simulcast_enabled_proxy.GetEncoderInfo().implementation_name);
|
|
||||||
|
|
||||||
NiceMock<MockEncoder>* mock_encoder1 = new NiceMock<MockEncoder>();
|
|
||||||
NiceMock<MockEncoder>* mock_encoder2 = new NiceMock<MockEncoder>();
|
|
||||||
NiceMock<MockEncoder>* mock_encoder3 = new NiceMock<MockEncoder>();
|
|
||||||
NiceMock<MockEncoder>* mock_encoder4 = new NiceMock<MockEncoder>();
|
|
||||||
NiceMock<MockVideoEncoderFactory> nonsimulcast_factory;
|
|
||||||
|
|
||||||
EXPECT_CALL(*mock_encoder1, InitEncode(_, _, _))
|
|
||||||
.WillOnce(
|
|
||||||
Return(WEBRTC_VIDEO_CODEC_ERR_SIMULCAST_PARAMETERS_NOT_SUPPORTED));
|
|
||||||
EXPECT_CALL(*mock_encoder1, GetEncoderInfo())
|
|
||||||
.WillRepeatedly(Return(encoder_info));
|
|
||||||
|
|
||||||
EXPECT_CALL(*mock_encoder2, InitEncode(_, _, _))
|
|
||||||
.WillOnce(Return(WEBRTC_VIDEO_CODEC_OK));
|
|
||||||
EXPECT_CALL(*mock_encoder2, GetEncoderInfo())
|
|
||||||
.WillRepeatedly(Return(encoder_info));
|
|
||||||
|
|
||||||
EXPECT_CALL(*mock_encoder3, InitEncode(_, _, _))
|
|
||||||
.WillOnce(Return(WEBRTC_VIDEO_CODEC_OK));
|
|
||||||
EXPECT_CALL(*mock_encoder3, GetEncoderInfo())
|
|
||||||
.WillRepeatedly(Return(encoder_info));
|
|
||||||
|
|
||||||
EXPECT_CALL(*mock_encoder4, InitEncode(_, _, _))
|
|
||||||
.WillOnce(Return(WEBRTC_VIDEO_CODEC_OK));
|
|
||||||
EXPECT_CALL(*mock_encoder4, GetEncoderInfo())
|
|
||||||
.WillRepeatedly(Return(encoder_info));
|
|
||||||
|
|
||||||
EXPECT_CALL(nonsimulcast_factory, CreateVideoEncoderProxy(_))
|
|
||||||
.Times(4)
|
|
||||||
.WillOnce(Return(mock_encoder1))
|
|
||||||
.WillOnce(Return(mock_encoder2))
|
|
||||||
.WillOnce(Return(mock_encoder3))
|
|
||||||
.WillOnce(Return(mock_encoder4));
|
|
||||||
|
|
||||||
VP8EncoderSimulcastProxy simulcast_disabled_proxy(&nonsimulcast_factory,
|
|
||||||
SdpVideoFormat("VP8"));
|
|
||||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
||||||
simulcast_disabled_proxy.InitEncode(&codec_settings, 4, 1200));
|
|
||||||
EXPECT_EQ(kSimulcastAdaptedImplementationName,
|
|
||||||
simulcast_disabled_proxy.GetEncoderInfo().implementation_name);
|
|
||||||
|
|
||||||
// Cleanup.
|
|
||||||
simulcast_enabled_proxy.Release();
|
|
||||||
simulcast_disabled_proxy.Release();
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(VP8EncoderSimulcastProxy, ForwardsTrustedSetting) {
|
|
||||||
NiceMock<MockEncoder>* mock_encoder = new NiceMock<MockEncoder>();
|
|
||||||
NiceMock<MockVideoEncoderFactory> simulcast_factory;
|
|
||||||
|
|
||||||
EXPECT_CALL(*mock_encoder, InitEncode(_, _, _))
|
|
||||||
.WillOnce(Return(WEBRTC_VIDEO_CODEC_OK));
|
|
||||||
|
|
||||||
EXPECT_CALL(simulcast_factory, CreateVideoEncoderProxy(_))
|
|
||||||
.Times(1)
|
|
||||||
.WillOnce(Return(mock_encoder));
|
|
||||||
|
|
||||||
VP8EncoderSimulcastProxy simulcast_enabled_proxy(&simulcast_factory,
|
|
||||||
SdpVideoFormat("VP8"));
|
|
||||||
VideoCodec codec_settings;
|
|
||||||
webrtc::test::CodecSettings(kVideoCodecVP8, &codec_settings);
|
|
||||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
||||||
simulcast_enabled_proxy.InitEncode(&codec_settings, 4, 1200));
|
|
||||||
|
|
||||||
VideoEncoder::EncoderInfo info;
|
|
||||||
info.has_trusted_rate_controller = true;
|
|
||||||
EXPECT_CALL(*mock_encoder, GetEncoderInfo()).WillRepeatedly(Return(info));
|
|
||||||
|
|
||||||
EXPECT_TRUE(
|
|
||||||
simulcast_enabled_proxy.GetEncoderInfo().has_trusted_rate_controller);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(VP8EncoderSimulcastProxy, ForwardsHardwareAccelerated) {
|
|
||||||
NiceMock<MockEncoder>* mock_encoder = new NiceMock<MockEncoder>();
|
|
||||||
NiceMock<MockVideoEncoderFactory> simulcast_factory;
|
|
||||||
|
|
||||||
EXPECT_CALL(*mock_encoder, InitEncode(_, _, _))
|
|
||||||
.WillOnce(Return(WEBRTC_VIDEO_CODEC_OK));
|
|
||||||
|
|
||||||
EXPECT_CALL(simulcast_factory, CreateVideoEncoderProxy(_))
|
|
||||||
.Times(1)
|
|
||||||
.WillOnce(Return(mock_encoder));
|
|
||||||
|
|
||||||
VP8EncoderSimulcastProxy simulcast_enabled_proxy(&simulcast_factory,
|
|
||||||
SdpVideoFormat("VP8"));
|
|
||||||
VideoCodec codec_settings;
|
|
||||||
webrtc::test::CodecSettings(kVideoCodecVP8, &codec_settings);
|
|
||||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
||||||
simulcast_enabled_proxy.InitEncode(&codec_settings, 4, 1200));
|
|
||||||
|
|
||||||
VideoEncoder::EncoderInfo info;
|
|
||||||
|
|
||||||
info.is_hardware_accelerated = false;
|
|
||||||
EXPECT_CALL(*mock_encoder, GetEncoderInfo()).WillOnce(Return(info));
|
|
||||||
EXPECT_FALSE(
|
|
||||||
simulcast_enabled_proxy.GetEncoderInfo().is_hardware_accelerated);
|
|
||||||
|
|
||||||
info.is_hardware_accelerated = true;
|
|
||||||
EXPECT_CALL(*mock_encoder, GetEncoderInfo()).WillOnce(Return(info));
|
|
||||||
EXPECT_TRUE(simulcast_enabled_proxy.GetEncoderInfo().is_hardware_accelerated);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(VP8EncoderSimulcastProxy, ForwardsInternalSource) {
|
|
||||||
NiceMock<MockEncoder>* mock_encoder = new NiceMock<MockEncoder>();
|
|
||||||
NiceMock<MockVideoEncoderFactory> simulcast_factory;
|
|
||||||
|
|
||||||
EXPECT_CALL(*mock_encoder, InitEncode(_, _, _))
|
|
||||||
.WillOnce(Return(WEBRTC_VIDEO_CODEC_OK));
|
|
||||||
|
|
||||||
EXPECT_CALL(simulcast_factory, CreateVideoEncoderProxy(_))
|
|
||||||
.Times(1)
|
|
||||||
.WillOnce(Return(mock_encoder));
|
|
||||||
|
|
||||||
VP8EncoderSimulcastProxy simulcast_enabled_proxy(&simulcast_factory,
|
|
||||||
SdpVideoFormat("VP8"));
|
|
||||||
VideoCodec codec_settings;
|
|
||||||
webrtc::test::CodecSettings(kVideoCodecVP8, &codec_settings);
|
|
||||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
||||||
simulcast_enabled_proxy.InitEncode(&codec_settings, 4, 1200));
|
|
||||||
|
|
||||||
VideoEncoder::EncoderInfo info;
|
|
||||||
|
|
||||||
info.has_internal_source = false;
|
|
||||||
EXPECT_CALL(*mock_encoder, GetEncoderInfo()).WillOnce(Return(info));
|
|
||||||
EXPECT_FALSE(simulcast_enabled_proxy.GetEncoderInfo().has_internal_source);
|
|
||||||
|
|
||||||
info.has_internal_source = true;
|
|
||||||
EXPECT_CALL(*mock_encoder, GetEncoderInfo()).WillOnce(Return(info));
|
|
||||||
EXPECT_TRUE(simulcast_enabled_proxy.GetEncoderInfo().has_internal_source);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace testing
|
|
||||||
} // namespace webrtc
|
|
Reference in New Issue
Block a user