Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: webrtc/modules/video_coding/main/source/video_sender_unittest.cc

Issue 1394823002: Remove internal encoders from VCMCodecDatabase. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include <vector> 11 #include <vector>
12 12
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 #include "webrtc/base/scoped_ptr.h" 14 #include "webrtc/base/scoped_ptr.h"
15 #include "webrtc/common.h" 15 #include "webrtc/common.h"
16 #include "webrtc/modules/video_coding/codecs/interface/mock/mock_video_codec_int erface.h" 16 #include "webrtc/modules/video_coding/codecs/interface/mock/mock_video_codec_int erface.h"
17 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
17 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h" 18 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h"
18 #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h" 19 #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h"
19 #include "webrtc/modules/video_coding/main/interface/mock/mock_vcm_callbacks.h" 20 #include "webrtc/modules/video_coding/main/interface/mock/mock_vcm_callbacks.h"
20 #include "webrtc/modules/video_coding/main/interface/video_coding.h" 21 #include "webrtc/modules/video_coding/main/interface/video_coding.h"
21 #include "webrtc/modules/video_coding/main/source/video_coding_impl.h" 22 #include "webrtc/modules/video_coding/main/source/video_coding_impl.h"
22 #include "webrtc/modules/video_coding/main/test/test_util.h" 23 #include "webrtc/modules/video_coding/main/test/test_util.h"
23 #include "webrtc/system_wrappers/interface/clock.h" 24 #include "webrtc/system_wrappers/interface/clock.h"
24 #include "webrtc/test/frame_generator.h" 25 #include "webrtc/test/frame_generator.h"
25 #include "webrtc/test/testsupport/fileutils.h" 26 #include "webrtc/test/testsupport/fileutils.h"
26 #include "webrtc/test/testsupport/gtest_disable.h" 27 #include "webrtc/test/testsupport/gtest_disable.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 } 184 }
184 185
185 void AddFrame() { 186 void AddFrame() {
186 assert(generator_.get()); 187 assert(generator_.get());
187 sender_->AddVideoFrame(*generator_->NextFrame(), NULL, NULL); 188 sender_->AddVideoFrame(*generator_->NextFrame(), NULL, NULL);
188 } 189 }
189 190
190 SimulatedClock clock_; 191 SimulatedClock clock_;
191 PacketizationCallback packetization_callback_; 192 PacketizationCallback packetization_callback_;
192 MockEncodedImageCallback post_encode_callback_; 193 MockEncodedImageCallback post_encode_callback_;
194 // Used by subclassing tests, need to outlive sender_.
195 rtc::scoped_ptr<VideoEncoder> encoder_;
193 rtc::scoped_ptr<VideoSender> sender_; 196 rtc::scoped_ptr<VideoSender> sender_;
194 rtc::scoped_ptr<FrameGenerator> generator_; 197 rtc::scoped_ptr<FrameGenerator> generator_;
195 }; 198 };
196 199
197 class TestVideoSenderWithMockEncoder : public TestVideoSender { 200 class TestVideoSenderWithMockEncoder : public TestVideoSender {
198 protected: 201 protected:
199 static const int kDefaultWidth = 1280; 202 static const int kDefaultWidth = 1280;
200 static const int kDefaultHeight = 720; 203 static const int kDefaultHeight = 720;
201 static const int kNumberOfStreams = 3; 204 static const int kNumberOfStreams = 3;
202 static const int kNumberOfLayers = 3; 205 static const int kNumberOfLayers = 3;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 const int width = 352; 343 const int width = 352;
341 const int height = 288; 344 const int height = 288;
342 generator_.reset(FrameGenerator::CreateFromYuvFile( 345 generator_.reset(FrameGenerator::CreateFromYuvFile(
343 std::vector<std::string>(1, test::ResourcePath(input_video, "yuv")), 346 std::vector<std::string>(1, test::ResourcePath(input_video, "yuv")),
344 width, height, 1)); 347 width, height, 1));
345 348
346 codec_ = MakeVp8VideoCodec(width, height, 3); 349 codec_ = MakeVp8VideoCodec(width, height, 3);
347 codec_.minBitrate = 10; 350 codec_.minBitrate = 10;
348 codec_.startBitrate = codec_bitrate_kbps_; 351 codec_.startBitrate = codec_bitrate_kbps_;
349 codec_.maxBitrate = codec_bitrate_kbps_; 352 codec_.maxBitrate = codec_bitrate_kbps_;
353 encoder_.reset(VP8Encoder::Create());
354 ASSERT_EQ(0, sender_->RegisterExternalEncoder(encoder_.get(), codec_.plType,
355 false));
350 EXPECT_EQ(0, sender_->RegisterSendCodec(&codec_, 1, 1200)); 356 EXPECT_EQ(0, sender_->RegisterSendCodec(&codec_, 1, 1200));
351 } 357 }
352 358
353 static VideoCodec MakeVp8VideoCodec(int width, 359 static VideoCodec MakeVp8VideoCodec(int width,
354 int height, 360 int height,
355 int temporal_layers) { 361 int temporal_layers) {
356 VideoCodec codec; 362 VideoCodec codec;
357 memset(&codec, 0, sizeof(codec)); 363 memset(&codec, 0, sizeof(codec));
358 EXPECT_EQ(0, VideoCodingModule::Codec(kVideoCodecVP8, &codec)); 364 EXPECT_EQ(0, VideoCodingModule::Codec(kVideoCodecVP8, &codec));
359 codec.width = width; 365 codec.width = width;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 } 452 }
447 { 453 {
448 // TODO(andresp): Find out why this fails with framerate = 7.5 454 // TODO(andresp): Find out why this fails with framerate = 7.5
449 Vp8StreamInfo expected = {{7.0, 7.0, 7.0}, {high_b, high_b, high_b}}; 455 Vp8StreamInfo expected = {{7.0, 7.0, 7.0}, {high_b, high_b, high_b}};
450 EXPECT_THAT(SimulateWithFramerate(7.0), MatchesVp8StreamInfo(expected)); 456 EXPECT_THAT(SimulateWithFramerate(7.0), MatchesVp8StreamInfo(expected));
451 } 457 }
452 } 458 }
453 } // namespace 459 } // namespace
454 } // namespace vcm 460 } // namespace vcm
455 } // namespace webrtc 461 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698