Remove extra_options from VideoCodec.
Constructing default options is racy when initializing multiple VP8 encoders in parallel. This is only used for VP8 temporal layers. Adding TemporalLayerFactory to VP8 codec specifics instead of generic options. Removes the last webrtc::Config uses/includes from video code. Also removes VideoCodec equality operators which are no longer in use. BUG=webrtc:5410 R=stefan@webrtc.org TBR=mflodman@webrtc.org Review URL: https://codereview.webrtc.org/1606613003 . Cr-Commit-Position: refs/heads/master@{#11307}
This commit is contained in:
@ -27,7 +27,6 @@
|
||||
#include "webrtc/call/bitrate_allocator.h"
|
||||
#include "webrtc/call/congestion_controller.h"
|
||||
#include "webrtc/call/rtc_event_log.h"
|
||||
#include "webrtc/common.h"
|
||||
#include "webrtc/config.h"
|
||||
#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
|
||||
#include "webrtc/modules/pacing/paced_sender.h"
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
#include "webrtc/base/thread_annotations.h"
|
||||
#include "webrtc/call.h"
|
||||
#include "webrtc/call/transport_adapter.h"
|
||||
#include "webrtc/common.h"
|
||||
#include "webrtc/config.h"
|
||||
#include "webrtc/modules/audio_coding/include/audio_coding_module.h"
|
||||
#include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
|
||||
|
||||
@ -13,7 +13,6 @@
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/base/thread_annotations.h"
|
||||
#include "webrtc/common.h"
|
||||
#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
|
||||
#include "webrtc/modules/pacing/paced_sender.h"
|
||||
#include "webrtc/modules/pacing/packet_router.h"
|
||||
|
||||
@ -569,6 +569,7 @@ enum VP8ResilienceMode {
|
||||
// within a frame.
|
||||
};
|
||||
|
||||
class TemporalLayersFactory;
|
||||
// VP8 specific
|
||||
struct VideoCodecVP8 {
|
||||
bool pictureLossIndicationOn;
|
||||
@ -581,23 +582,7 @@ struct VideoCodecVP8 {
|
||||
bool automaticResizeOn;
|
||||
bool frameDroppingOn;
|
||||
int keyFrameInterval;
|
||||
|
||||
bool operator==(const VideoCodecVP8& other) const {
|
||||
return pictureLossIndicationOn == other.pictureLossIndicationOn &&
|
||||
feedbackModeOn == other.feedbackModeOn &&
|
||||
complexity == other.complexity &&
|
||||
resilience == other.resilience &&
|
||||
numberOfTemporalLayers == other.numberOfTemporalLayers &&
|
||||
denoisingOn == other.denoisingOn &&
|
||||
errorConcealmentOn == other.errorConcealmentOn &&
|
||||
automaticResizeOn == other.automaticResizeOn &&
|
||||
frameDroppingOn == other.frameDroppingOn &&
|
||||
keyFrameInterval == other.keyFrameInterval;
|
||||
}
|
||||
|
||||
bool operator!=(const VideoCodecVP8& other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
const TemporalLayersFactory* tl_factory;
|
||||
};
|
||||
|
||||
// VP9 specific.
|
||||
@ -655,20 +640,6 @@ struct SimulcastStream {
|
||||
unsigned int targetBitrate; // kilobits/sec.
|
||||
unsigned int minBitrate; // kilobits/sec.
|
||||
unsigned int qpMax; // minimum quality
|
||||
|
||||
bool operator==(const SimulcastStream& other) const {
|
||||
return width == other.width &&
|
||||
height == other.height &&
|
||||
numberOfTemporalLayers == other.numberOfTemporalLayers &&
|
||||
maxBitrate == other.maxBitrate &&
|
||||
targetBitrate == other.targetBitrate &&
|
||||
minBitrate == other.minBitrate &&
|
||||
qpMax == other.qpMax;
|
||||
}
|
||||
|
||||
bool operator!=(const SimulcastStream& other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
};
|
||||
|
||||
struct SpatialLayer {
|
||||
@ -708,37 +679,8 @@ struct VideoCodec {
|
||||
|
||||
VideoCodecMode mode;
|
||||
|
||||
// When using an external encoder/decoder this allows to pass
|
||||
// extra options without requiring webrtc to be aware of them.
|
||||
Config* extra_options;
|
||||
|
||||
bool operator==(const VideoCodec& other) const {
|
||||
bool ret = codecType == other.codecType &&
|
||||
(STR_CASE_CMP(plName, other.plName) == 0) &&
|
||||
plType == other.plType &&
|
||||
width == other.width &&
|
||||
height == other.height &&
|
||||
startBitrate == other.startBitrate &&
|
||||
maxBitrate == other.maxBitrate &&
|
||||
minBitrate == other.minBitrate &&
|
||||
targetBitrate == other.targetBitrate &&
|
||||
maxFramerate == other.maxFramerate &&
|
||||
qpMax == other.qpMax &&
|
||||
numberOfSimulcastStreams == other.numberOfSimulcastStreams &&
|
||||
mode == other.mode;
|
||||
if (ret && codecType == kVideoCodecVP8) {
|
||||
ret &= (codecSpecific.VP8 == other.codecSpecific.VP8);
|
||||
}
|
||||
|
||||
for (unsigned char i = 0; i < other.numberOfSimulcastStreams && ret; ++i) {
|
||||
ret &= (simulcastStream[i] == other.simulcastStream[i]);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool operator!=(const VideoCodec& other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
bool operator==(const VideoCodec& other) const = delete;
|
||||
bool operator!=(const VideoCodec& other) const = delete;
|
||||
};
|
||||
|
||||
// Bandwidth over-use detector options. These are used to drive
|
||||
|
||||
@ -328,8 +328,7 @@ bool VCMCodecDataBase::RequiresEncoderReset(const VideoCodec& new_send_codec) {
|
||||
new_send_codec.qpMax != send_codec_.qpMax ||
|
||||
new_send_codec.numberOfSimulcastStreams !=
|
||||
send_codec_.numberOfSimulcastStreams ||
|
||||
new_send_codec.mode != send_codec_.mode ||
|
||||
new_send_codec.extra_options != send_codec_.extra_options) {
|
||||
new_send_codec.mode != send_codec_.mode) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -283,7 +283,7 @@ void DefaultTemporalLayers::PopulateCodecSpecific(
|
||||
}
|
||||
}
|
||||
|
||||
TemporalLayers* TemporalLayers::Factory::Create(
|
||||
TemporalLayers* TemporalLayersFactory::Create(
|
||||
int temporal_layers,
|
||||
uint8_t initial_tl0_pic_idx) const {
|
||||
return new DefaultTemporalLayers(temporal_layers, initial_tl0_pic_idx);
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
#include "libyuv/scale.h" // NOLINT
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/common.h"
|
||||
#include "webrtc/modules/video_coding/codecs/vp8/screenshare_layers.h"
|
||||
|
||||
namespace {
|
||||
@ -95,7 +94,7 @@ int VerifyCodec(const webrtc::VideoCodec* inst) {
|
||||
// TL1 FrameDropper's max time to drop frames.
|
||||
const float kTl1MaxTimeToDropFrames = 20.0f;
|
||||
|
||||
struct ScreenshareTemporalLayersFactory : webrtc::TemporalLayers::Factory {
|
||||
struct ScreenshareTemporalLayersFactory : webrtc::TemporalLayersFactory {
|
||||
ScreenshareTemporalLayersFactory()
|
||||
: tl1_frame_dropper_(kTl1MaxTimeToDropFrames) {}
|
||||
|
||||
@ -189,10 +188,8 @@ int SimulcastEncoderAdapter::InitEncode(const VideoCodec* inst,
|
||||
|
||||
// Special mode when screensharing on a single stream.
|
||||
if (number_of_streams == 1 && inst->mode == kScreensharing) {
|
||||
screensharing_extra_options_.reset(new Config());
|
||||
screensharing_extra_options_->Set<TemporalLayers::Factory>(
|
||||
new ScreenshareTemporalLayersFactory());
|
||||
codec_.extra_options = screensharing_extra_options_.get();
|
||||
screensharing_tl_factory_.reset(new ScreenshareTemporalLayersFactory());
|
||||
codec_.codecSpecific.VP8.tl_factory = screensharing_tl_factory_.get();
|
||||
}
|
||||
|
||||
// Create |number_of_streams| of encoder instances and init them.
|
||||
|
||||
@ -110,7 +110,7 @@ class SimulcastEncoderAdapter : public VP8Encoder {
|
||||
bool Initialized() const;
|
||||
|
||||
rtc::scoped_ptr<VideoEncoderFactory> factory_;
|
||||
rtc::scoped_ptr<Config> screensharing_extra_options_;
|
||||
rtc::scoped_ptr<TemporalLayersFactory> screensharing_tl_factory_;
|
||||
VideoCodec codec_;
|
||||
std::vector<StreamInfo> streaminfos_;
|
||||
EncodedImageCallback* encoded_complete_callback_;
|
||||
|
||||
@ -278,10 +278,11 @@ class TestSimulcastEncoderAdapterFake : public ::testing::Test,
|
||||
target.codecSpecific.VP8.frameDroppingOn);
|
||||
EXPECT_EQ(ref.codecSpecific.VP8.keyFrameInterval,
|
||||
target.codecSpecific.VP8.keyFrameInterval);
|
||||
EXPECT_EQ(ref.codecSpecific.VP8.tl_factory,
|
||||
target.codecSpecific.VP8.tl_factory);
|
||||
EXPECT_EQ(ref.qpMax, target.qpMax);
|
||||
EXPECT_EQ(0, target.numberOfSimulcastStreams);
|
||||
EXPECT_EQ(ref.mode, target.mode);
|
||||
EXPECT_EQ(ref.extra_options, target.extra_options);
|
||||
|
||||
// No need to compare simulcastStream as numberOfSimulcastStreams should
|
||||
// always be 0.
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/common.h"
|
||||
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "webrtc/modules/video_coding/include/mock/mock_video_codec_interface.h"
|
||||
#include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
|
||||
@ -147,19 +146,16 @@ class SkipEncodingUnusedStreamsTest {
|
||||
std::vector<unsigned int> RunTest(VP8Encoder* encoder,
|
||||
VideoCodec* settings,
|
||||
uint32_t target_bitrate) {
|
||||
Config options;
|
||||
SpyingTemporalLayersFactory* spy_factory =
|
||||
new SpyingTemporalLayersFactory();
|
||||
options.Set<TemporalLayers::Factory>(spy_factory);
|
||||
settings->extra_options = &options;
|
||||
SpyingTemporalLayersFactory spy_factory;
|
||||
settings->codecSpecific.VP8.tl_factory = &spy_factory;
|
||||
EXPECT_EQ(0, encoder->InitEncode(settings, 1, 1200));
|
||||
|
||||
encoder->SetRates(target_bitrate, 30);
|
||||
|
||||
std::vector<unsigned int> configured_bitrates;
|
||||
for (std::vector<TemporalLayers*>::const_iterator it =
|
||||
spy_factory->spying_layers_.begin();
|
||||
it != spy_factory->spying_layers_.end(); ++it) {
|
||||
spy_factory.spying_layers_.begin();
|
||||
it != spy_factory.spying_layers_.end(); ++it) {
|
||||
configured_bitrates.push_back(
|
||||
static_cast<SpyingTemporalLayers*>(*it)->configured_bitrate_);
|
||||
}
|
||||
@ -206,13 +202,13 @@ class SkipEncodingUnusedStreamsTest {
|
||||
TemporalLayers* layers_;
|
||||
};
|
||||
|
||||
class SpyingTemporalLayersFactory : public TemporalLayers::Factory {
|
||||
class SpyingTemporalLayersFactory : public TemporalLayersFactory {
|
||||
public:
|
||||
virtual ~SpyingTemporalLayersFactory() {}
|
||||
TemporalLayers* Create(int temporal_layers,
|
||||
uint8_t initial_tl0_pic_idx) const override {
|
||||
SpyingTemporalLayers* layers =
|
||||
new SpyingTemporalLayers(TemporalLayers::Factory::Create(
|
||||
new SpyingTemporalLayers(TemporalLayersFactory::Create(
|
||||
temporal_layers, initial_tl0_pic_idx));
|
||||
spying_layers_.push_back(layers);
|
||||
return layers;
|
||||
|
||||
@ -14,7 +14,6 @@
|
||||
|
||||
#include "vpx/vpx_encoder.h"
|
||||
|
||||
#include "webrtc/common.h"
|
||||
#include "webrtc/common_video/include/video_image.h"
|
||||
#include "webrtc/typedefs.h"
|
||||
|
||||
@ -26,15 +25,6 @@ class TemporalLayers {
|
||||
public:
|
||||
// Factory for TemporalLayer strategy. Default behaviour is a fixed pattern
|
||||
// of temporal layers. See default_temporal_layers.cc
|
||||
struct Factory {
|
||||
Factory() {}
|
||||
virtual ~Factory() {}
|
||||
virtual TemporalLayers* Create(int temporal_layers,
|
||||
uint8_t initial_tl0_pic_idx) const;
|
||||
static const ConfigOptionID identifier =
|
||||
ConfigOptionID::kTemporalLayersFactory;
|
||||
};
|
||||
|
||||
virtual ~TemporalLayers() {}
|
||||
|
||||
// Returns the recommended VP8 encode flags needed. May refresh the decoder
|
||||
@ -57,13 +47,21 @@ class TemporalLayers {
|
||||
virtual bool UpdateConfiguration(vpx_codec_enc_cfg_t* cfg) = 0;
|
||||
};
|
||||
|
||||
class TemporalLayersFactory {
|
||||
public:
|
||||
virtual ~TemporalLayersFactory() {}
|
||||
virtual TemporalLayers* Create(int temporal_layers,
|
||||
uint8_t initial_tl0_pic_idx) const;
|
||||
};
|
||||
|
||||
// Factory for a temporal layers strategy that adaptively changes the number of
|
||||
// layers based on input framerate so that the base layer has an acceptable
|
||||
// framerate. See realtime_temporal_layers.cc
|
||||
struct RealTimeTemporalLayersFactory : TemporalLayers::Factory {
|
||||
virtual ~RealTimeTemporalLayersFactory() {}
|
||||
virtual TemporalLayers* Create(int num_temporal_layers,
|
||||
uint8_t initial_tl0_pic_idx) const;
|
||||
class RealTimeTemporalLayersFactory : public TemporalLayersFactory {
|
||||
public:
|
||||
~RealTimeTemporalLayersFactory() override {}
|
||||
TemporalLayers* Create(int num_temporal_layers,
|
||||
uint8_t initial_tl0_pic_idx) const override;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -21,7 +21,6 @@
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/trace_event.h"
|
||||
#include "webrtc/common.h"
|
||||
#include "webrtc/common_types.h"
|
||||
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "webrtc/modules/include/module_common_types.h"
|
||||
@ -314,10 +313,10 @@ void VP8EncoderImpl::SetStreamState(bool send_stream,
|
||||
void VP8EncoderImpl::SetupTemporalLayers(int num_streams,
|
||||
int num_temporal_layers,
|
||||
const VideoCodec& codec) {
|
||||
const Config default_options;
|
||||
const TemporalLayers::Factory& tl_factory =
|
||||
(codec.extra_options ? codec.extra_options : &default_options)
|
||||
->Get<TemporalLayers::Factory>();
|
||||
TemporalLayersFactory default_factory;
|
||||
const TemporalLayersFactory* tl_factory = codec.codecSpecific.VP8.tl_factory;
|
||||
if (!tl_factory)
|
||||
tl_factory = &default_factory;
|
||||
if (num_streams == 1) {
|
||||
if (codec.mode == kScreensharing) {
|
||||
// Special mode when screensharing on a single stream.
|
||||
@ -325,7 +324,7 @@ void VP8EncoderImpl::SetupTemporalLayers(int num_streams,
|
||||
new ScreenshareLayers(num_temporal_layers, rand()));
|
||||
} else {
|
||||
temporal_layers_.push_back(
|
||||
tl_factory.Create(num_temporal_layers, rand()));
|
||||
tl_factory->Create(num_temporal_layers, rand()));
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < num_streams; ++i) {
|
||||
@ -333,7 +332,7 @@ void VP8EncoderImpl::SetupTemporalLayers(int num_streams,
|
||||
int layers = codec.simulcastStream[i].numberOfTemporalLayers;
|
||||
if (layers < 1)
|
||||
layers = 1;
|
||||
temporal_layers_.push_back(tl_factory.Create(layers, rand()));
|
||||
temporal_layers_.push_back(tl_factory->Create(layers, rand()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,7 +25,6 @@
|
||||
#include "webrtc/base/keep_ref_until_done.h"
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/base/trace_event.h"
|
||||
#include "webrtc/common.h"
|
||||
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "webrtc/modules/include/module_common_types.h"
|
||||
#include "webrtc/modules/video_coding/codecs/vp9/screenshare_layers.h"
|
||||
|
||||
@ -12,7 +12,6 @@
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/common.h"
|
||||
#include "webrtc/modules/video_coding/include/mock/mock_video_codec_interface.h"
|
||||
#include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
|
||||
#include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h"
|
||||
@ -461,11 +460,9 @@ TEST_F(TestVideoSenderWithVp8, MAYBE_FixedTemporalLayersStrategy) {
|
||||
#define MAYBE_RealTimeTemporalLayersStrategy RealTimeTemporalLayersStrategy
|
||||
#endif
|
||||
TEST_F(TestVideoSenderWithVp8, MAYBE_RealTimeTemporalLayersStrategy) {
|
||||
Config extra_options;
|
||||
extra_options.Set<TemporalLayers::Factory>(
|
||||
new RealTimeTemporalLayersFactory());
|
||||
VideoCodec codec = MakeVp8VideoCodec(352, 288, 3);
|
||||
codec.extra_options = &extra_options;
|
||||
RealTimeTemporalLayersFactory realtime_tl_factory;
|
||||
codec.codecSpecific.VP8.tl_factory = &realtime_tl_factory;
|
||||
codec.minBitrate = 10;
|
||||
codec.startBitrate = codec_bitrate_kbps_;
|
||||
codec.maxBitrate = codec_bitrate_kbps_;
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/common.h"
|
||||
#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
|
||||
#include "webrtc/modules/pacing/paced_sender.h"
|
||||
#include "webrtc/modules/pacing/packet_router.h"
|
||||
|
||||
@ -15,7 +15,6 @@
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "webrtc/base/event.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/common.h"
|
||||
#include "webrtc/modules/utility/include/mock/mock_process_thread.h"
|
||||
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
|
||||
#include "webrtc/system_wrappers/include/ref_count.h"
|
||||
@ -61,7 +60,6 @@ class VideoCaptureInputTest : public ::testing::Test {
|
||||
.WillRepeatedly(
|
||||
WithArg<0>(Invoke(this, &VideoCaptureInputTest::AddOutputFrame)));
|
||||
|
||||
Config config;
|
||||
input_.reset(new internal::VideoCaptureInput(
|
||||
mock_process_thread_.get(), mock_frame_callback_.get(), nullptr,
|
||||
&stats_proxy_, nullptr, nullptr));
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/base/platform_thread.h"
|
||||
#include "webrtc/common.h"
|
||||
#include "webrtc/common_video/include/incoming_video_stream.h"
|
||||
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "webrtc/frame_callback.h"
|
||||
|
||||
@ -1,230 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014 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 "testing/gtest/include/gtest/gtest.h"
|
||||
#include "webrtc/common_types.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
// Builds VP8 codec with 0 simulcast streams.
|
||||
void BuildVP8Codec(webrtc::VideoCodec* video_codec) {
|
||||
video_codec->codecType = kVideoCodecVP8;
|
||||
strncpy(video_codec->plName, "VP8", 4);
|
||||
video_codec->plType = 100;
|
||||
video_codec->width = 1280;
|
||||
video_codec->height = 720;
|
||||
|
||||
video_codec->startBitrate = 1000; // kbps
|
||||
video_codec->maxBitrate = 2000; // kbps
|
||||
video_codec->minBitrate = 1000; // kbps
|
||||
video_codec->maxFramerate = 30;
|
||||
|
||||
video_codec->qpMax = 50;
|
||||
video_codec->numberOfSimulcastStreams = 0;
|
||||
video_codec->mode = kRealtimeVideo;
|
||||
|
||||
// Set VP8 codec specific info.
|
||||
video_codec->codecSpecific.VP8.pictureLossIndicationOn = true;
|
||||
video_codec->codecSpecific.VP8.feedbackModeOn = true;
|
||||
video_codec->codecSpecific.VP8.complexity = kComplexityNormal;
|
||||
video_codec->codecSpecific.VP8.resilience = kResilienceOff;
|
||||
video_codec->codecSpecific.VP8.numberOfTemporalLayers = 0;
|
||||
video_codec->codecSpecific.VP8.denoisingOn = true;
|
||||
video_codec->codecSpecific.VP8.errorConcealmentOn = true;
|
||||
video_codec->codecSpecific.VP8.automaticResizeOn = true;
|
||||
video_codec->codecSpecific.VP8.frameDroppingOn = true;
|
||||
video_codec->codecSpecific.VP8.keyFrameInterval = 200;
|
||||
}
|
||||
|
||||
|
||||
void SetSimulcastSettings(webrtc::VideoCodec* video_codec) {
|
||||
// Simulcast settings.
|
||||
video_codec->numberOfSimulcastStreams = 1;
|
||||
video_codec->simulcastStream[0].width = 320;
|
||||
video_codec->simulcastStream[0].height = 180;
|
||||
video_codec->simulcastStream[0].numberOfTemporalLayers = 0;
|
||||
video_codec->simulcastStream[0].maxBitrate = 100;
|
||||
video_codec->simulcastStream[0].targetBitrate = 100;
|
||||
video_codec->simulcastStream[0].minBitrate = 0;
|
||||
video_codec->simulcastStream[0].qpMax = video_codec->qpMax;
|
||||
}
|
||||
|
||||
|
||||
// This test compares two VideoCodecInst objects except codec specific and
|
||||
// simulcast streams.
|
||||
TEST(ViECodecTest, TestCompareCodecs) {
|
||||
VideoCodec codec1, codec2;
|
||||
memset(&codec1, 0, sizeof(VideoCodec));
|
||||
memset(&codec2, 0, sizeof(VideoCodec));
|
||||
|
||||
BuildVP8Codec(&codec1);
|
||||
BuildVP8Codec(&codec2);
|
||||
|
||||
EXPECT_TRUE(codec1 == codec2);
|
||||
EXPECT_FALSE(codec1 != codec2);
|
||||
|
||||
// plname is case insensitive.
|
||||
strncpy(codec2.plName, "vp8", 4);
|
||||
EXPECT_TRUE(codec1 == codec2);
|
||||
|
||||
codec2.codecType = kVideoCodecUnknown;
|
||||
EXPECT_FALSE(codec1 == codec2);
|
||||
|
||||
// Modify pltype.
|
||||
BuildVP8Codec(&codec2);
|
||||
codec2.plType = 101;
|
||||
EXPECT_FALSE(codec1 == codec2);
|
||||
|
||||
// Modifing height and width.
|
||||
BuildVP8Codec(&codec2);
|
||||
codec2.width = 640;
|
||||
codec2.height = 480;
|
||||
EXPECT_FALSE(codec1 == codec2);
|
||||
|
||||
// Modify framerate, default value is 30.
|
||||
BuildVP8Codec(&codec2);
|
||||
codec2.maxFramerate = 15;
|
||||
EXPECT_FALSE(codec1 == codec2);
|
||||
|
||||
// Modifying startBitrate, default value is 1000 kbps.
|
||||
BuildVP8Codec(&codec2);
|
||||
codec2.startBitrate = 2000;
|
||||
EXPECT_FALSE(codec1 == codec2);
|
||||
// maxBitrate
|
||||
BuildVP8Codec(&codec2);
|
||||
codec2.startBitrate = 3000;
|
||||
EXPECT_FALSE(codec1 == codec2);
|
||||
// minBirate
|
||||
BuildVP8Codec(&codec2);
|
||||
codec2.startBitrate = 500;
|
||||
EXPECT_FALSE(codec1 == codec2);
|
||||
|
||||
// Modify qpMax.
|
||||
BuildVP8Codec(&codec2);
|
||||
codec2.qpMax = 100;
|
||||
EXPECT_FALSE(codec1 == codec2);
|
||||
|
||||
// Modify mode
|
||||
BuildVP8Codec(&codec2);
|
||||
codec2.mode = kScreensharing;
|
||||
EXPECT_FALSE(codec1 == codec2);
|
||||
}
|
||||
|
||||
// Test VP8 specific comparision.
|
||||
TEST(ViECodecTest, TestCompareVP8CodecSpecific) {
|
||||
VideoCodec codec1, codec2;
|
||||
memset(&codec1, 0, sizeof(VideoCodec));
|
||||
memset(&codec2, 0, sizeof(VideoCodec));
|
||||
|
||||
BuildVP8Codec(&codec1);
|
||||
BuildVP8Codec(&codec2);
|
||||
EXPECT_TRUE(codec1 == codec2);
|
||||
|
||||
// pictureLossIndicationOn
|
||||
codec2.codecSpecific.VP8.pictureLossIndicationOn = false;
|
||||
EXPECT_FALSE(codec1 == codec2);
|
||||
|
||||
// feedbackModeOn
|
||||
BuildVP8Codec(&codec2);
|
||||
codec2.codecSpecific.VP8.feedbackModeOn = false;
|
||||
EXPECT_FALSE(codec1 == codec2);
|
||||
|
||||
// complexity
|
||||
BuildVP8Codec(&codec2);
|
||||
codec2.codecSpecific.VP8.complexity = kComplexityHigh;
|
||||
EXPECT_FALSE(codec1 == codec2);
|
||||
|
||||
// resilience
|
||||
BuildVP8Codec(&codec2);
|
||||
codec2.codecSpecific.VP8.resilience = kResilientStream;
|
||||
EXPECT_FALSE(codec1 == codec2);
|
||||
|
||||
// numberOfTemporalLayers
|
||||
BuildVP8Codec(&codec2);
|
||||
codec2.codecSpecific.VP8.numberOfTemporalLayers = 2;
|
||||
EXPECT_FALSE(codec1 == codec2);
|
||||
|
||||
// denoisingOn
|
||||
BuildVP8Codec(&codec2);
|
||||
codec2.codecSpecific.VP8.denoisingOn = false;
|
||||
EXPECT_FALSE(codec1 == codec2);
|
||||
|
||||
// errorConcealmentOn
|
||||
BuildVP8Codec(&codec2);
|
||||
codec2.codecSpecific.VP8.errorConcealmentOn = false;
|
||||
EXPECT_FALSE(codec1 == codec2);
|
||||
|
||||
// pictureLossIndicationOn
|
||||
BuildVP8Codec(&codec2);
|
||||
codec2.codecSpecific.VP8.automaticResizeOn = false;
|
||||
EXPECT_FALSE(codec1 == codec2);
|
||||
|
||||
// frameDroppingOn
|
||||
BuildVP8Codec(&codec2);
|
||||
codec2.codecSpecific.VP8.frameDroppingOn = false;
|
||||
EXPECT_FALSE(codec1 == codec2);
|
||||
|
||||
// keyFrameInterval
|
||||
BuildVP8Codec(&codec2);
|
||||
codec2.codecSpecific.VP8.keyFrameInterval = 100;
|
||||
EXPECT_FALSE(codec1 == codec2);
|
||||
}
|
||||
|
||||
// This test compares simulcast stream information in VideoCodec.
|
||||
TEST(ViECodecTest, TestCompareSimulcastStreams) {
|
||||
VideoCodec codec1, codec2;
|
||||
memset(&codec1, 0, sizeof(VideoCodec));
|
||||
memset(&codec2, 0, sizeof(VideoCodec));
|
||||
|
||||
BuildVP8Codec(&codec1);
|
||||
BuildVP8Codec(&codec2);
|
||||
// Set simulacast settings.
|
||||
SetSimulcastSettings(&codec1);
|
||||
SetSimulcastSettings(&codec2);
|
||||
EXPECT_TRUE(codec1 == codec2);
|
||||
|
||||
// Modify number of streams.
|
||||
codec2.numberOfSimulcastStreams = 2;
|
||||
EXPECT_FALSE(codec1 == codec2);
|
||||
|
||||
// Resetting steram count.
|
||||
codec2.numberOfSimulcastStreams = 1;
|
||||
// Modify height and width in codec2.
|
||||
codec2.simulcastStream[0].width = 640;
|
||||
codec2.simulcastStream[0].height = 480;
|
||||
EXPECT_FALSE(codec1 == codec2);
|
||||
|
||||
// numberOfTemporalLayers
|
||||
SetSimulcastSettings(&codec2);
|
||||
codec2.simulcastStream[0].numberOfTemporalLayers = 2;
|
||||
EXPECT_FALSE(codec1 == codec2);
|
||||
|
||||
// maxBitrate
|
||||
SetSimulcastSettings(&codec2);
|
||||
codec2.simulcastStream[0].maxBitrate = 1000;
|
||||
EXPECT_FALSE(codec1 == codec2);
|
||||
|
||||
// targetBitrate
|
||||
SetSimulcastSettings(&codec2);
|
||||
codec2.simulcastStream[0].targetBitrate = 1000;
|
||||
EXPECT_FALSE(codec1 == codec2);
|
||||
|
||||
// minBitrate
|
||||
SetSimulcastSettings(&codec2);
|
||||
codec2.simulcastStream[0].minBitrate = 50;
|
||||
EXPECT_FALSE(codec1 == codec2);
|
||||
|
||||
// qpMax
|
||||
SetSimulcastSettings(&codec2);
|
||||
codec2.simulcastStream[0].qpMax = 100;
|
||||
EXPECT_FALSE(codec1 == codec2);
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
@ -177,7 +177,6 @@
|
||||
'video/video_decoder_unittest.cc',
|
||||
'video/video_encoder_unittest.cc',
|
||||
'video/video_send_stream_tests.cc',
|
||||
'video/vie_codec_unittest.cc',
|
||||
'video/vie_remb_unittest.cc',
|
||||
],
|
||||
'dependencies': [
|
||||
|
||||
Reference in New Issue
Block a user