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

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

Issue 1479793002: Remove RegisterExternal{De,En}coder error codes. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « webrtc/modules/video_coding/video_sender.cc ('k') | webrtc/video/video_receive_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 class TestVideoSenderWithMockEncoder : public TestVideoSender { 200 class TestVideoSenderWithMockEncoder : public TestVideoSender {
201 protected: 201 protected:
202 static const int kDefaultWidth = 1280; 202 static const int kDefaultWidth = 1280;
203 static const int kDefaultHeight = 720; 203 static const int kDefaultHeight = 720;
204 static const int kNumberOfStreams = 3; 204 static const int kNumberOfStreams = 3;
205 static const int kNumberOfLayers = 3; 205 static const int kNumberOfLayers = 3;
206 static const int kUnusedPayloadType = 10; 206 static const int kUnusedPayloadType = 10;
207 207
208 void SetUp() override { 208 void SetUp() override {
209 TestVideoSender::SetUp(); 209 TestVideoSender::SetUp();
210 EXPECT_EQ( 210 sender_->RegisterExternalEncoder(&encoder_, kUnusedPayloadType, false);
211 0,
212 sender_->RegisterExternalEncoder(&encoder_, kUnusedPayloadType, false));
213 memset(&settings_, 0, sizeof(settings_)); 211 memset(&settings_, 0, sizeof(settings_));
214 EXPECT_EQ(0, VideoCodingModule::Codec(kVideoCodecVP8, &settings_)); 212 EXPECT_EQ(0, VideoCodingModule::Codec(kVideoCodecVP8, &settings_));
215 settings_.numberOfSimulcastStreams = kNumberOfStreams; 213 settings_.numberOfSimulcastStreams = kNumberOfStreams;
216 ConfigureStream(kDefaultWidth / 4, 214 ConfigureStream(kDefaultWidth / 4,
217 kDefaultHeight / 4, 215 kDefaultHeight / 4,
218 100, 216 100,
219 &settings_.simulcastStream[0]); 217 &settings_.simulcastStream[0]);
220 ConfigureStream(kDefaultWidth / 2, 218 ConfigureStream(kDefaultWidth / 2,
221 kDefaultHeight / 2, 219 kDefaultHeight / 2,
222 500, 220 500,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 ExpectIntraRequest(-1); 291 ExpectIntraRequest(-1);
294 AddFrame(); 292 AddFrame();
295 293
296 EXPECT_EQ(-1, sender_->IntraFrameRequest(-1)); 294 EXPECT_EQ(-1, sender_->IntraFrameRequest(-1));
297 ExpectIntraRequest(-1); 295 ExpectIntraRequest(-1);
298 AddFrame(); 296 AddFrame();
299 } 297 }
300 298
301 TEST_F(TestVideoSenderWithMockEncoder, TestIntraRequestsInternalCapture) { 299 TEST_F(TestVideoSenderWithMockEncoder, TestIntraRequestsInternalCapture) {
302 // De-register current external encoder. 300 // De-register current external encoder.
303 EXPECT_EQ(0, 301 sender_->RegisterExternalEncoder(nullptr, kUnusedPayloadType, false);
304 sender_->RegisterExternalEncoder(NULL, kUnusedPayloadType, false));
305 // Register encoder with internal capture. 302 // Register encoder with internal capture.
306 EXPECT_EQ( 303 sender_->RegisterExternalEncoder(&encoder_, kUnusedPayloadType, true);
307 0, sender_->RegisterExternalEncoder(&encoder_, kUnusedPayloadType, true));
308 EXPECT_EQ(0, sender_->RegisterSendCodec(&settings_, 1, 1200)); 304 EXPECT_EQ(0, sender_->RegisterSendCodec(&settings_, 1, 1200));
309 ExpectIntraRequest(0); 305 ExpectIntraRequest(0);
310 EXPECT_EQ(0, sender_->IntraFrameRequest(0)); 306 EXPECT_EQ(0, sender_->IntraFrameRequest(0));
311 ExpectIntraRequest(1); 307 ExpectIntraRequest(1);
312 EXPECT_EQ(0, sender_->IntraFrameRequest(1)); 308 EXPECT_EQ(0, sender_->IntraFrameRequest(1));
313 ExpectIntraRequest(2); 309 ExpectIntraRequest(2);
314 EXPECT_EQ(0, sender_->IntraFrameRequest(2)); 310 EXPECT_EQ(0, sender_->IntraFrameRequest(2));
315 // No requests expected since these indices are out of bounds. 311 // No requests expected since these indices are out of bounds.
316 EXPECT_EQ(-1, sender_->IntraFrameRequest(3)); 312 EXPECT_EQ(-1, sender_->IntraFrameRequest(3));
317 EXPECT_EQ(-1, sender_->IntraFrameRequest(-1)); 313 EXPECT_EQ(-1, sender_->IntraFrameRequest(-1));
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 const int height = 288; 373 const int height = 288;
378 generator_.reset(FrameGenerator::CreateFromYuvFile( 374 generator_.reset(FrameGenerator::CreateFromYuvFile(
379 std::vector<std::string>(1, test::ResourcePath(input_video, "yuv")), 375 std::vector<std::string>(1, test::ResourcePath(input_video, "yuv")),
380 width, height, 1)); 376 width, height, 1));
381 377
382 codec_ = MakeVp8VideoCodec(width, height, 3); 378 codec_ = MakeVp8VideoCodec(width, height, 3);
383 codec_.minBitrate = 10; 379 codec_.minBitrate = 10;
384 codec_.startBitrate = codec_bitrate_kbps_; 380 codec_.startBitrate = codec_bitrate_kbps_;
385 codec_.maxBitrate = codec_bitrate_kbps_; 381 codec_.maxBitrate = codec_bitrate_kbps_;
386 encoder_.reset(VP8Encoder::Create()); 382 encoder_.reset(VP8Encoder::Create());
387 ASSERT_EQ(0, sender_->RegisterExternalEncoder(encoder_.get(), codec_.plType, 383 sender_->RegisterExternalEncoder(encoder_.get(), codec_.plType, false);
388 false));
389 EXPECT_EQ(0, sender_->RegisterSendCodec(&codec_, 1, 1200)); 384 EXPECT_EQ(0, sender_->RegisterSendCodec(&codec_, 1, 1200));
390 } 385 }
391 386
392 static VideoCodec MakeVp8VideoCodec(int width, 387 static VideoCodec MakeVp8VideoCodec(int width,
393 int height, 388 int height,
394 int temporal_layers) { 389 int temporal_layers) {
395 VideoCodec codec; 390 VideoCodec codec;
396 memset(&codec, 0, sizeof(codec)); 391 memset(&codec, 0, sizeof(codec));
397 EXPECT_EQ(0, VideoCodingModule::Codec(kVideoCodecVP8, &codec)); 392 EXPECT_EQ(0, VideoCodingModule::Codec(kVideoCodecVP8, &codec));
398 codec.width = width; 393 codec.width = width;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 } 480 }
486 { 481 {
487 // TODO(andresp): Find out why this fails with framerate = 7.5 482 // TODO(andresp): Find out why this fails with framerate = 7.5
488 Vp8StreamInfo expected = {{7.0, 7.0, 7.0}, {high_b, high_b, high_b}}; 483 Vp8StreamInfo expected = {{7.0, 7.0, 7.0}, {high_b, high_b, high_b}};
489 EXPECT_THAT(SimulateWithFramerate(7.0), MatchesVp8StreamInfo(expected)); 484 EXPECT_THAT(SimulateWithFramerate(7.0), MatchesVp8StreamInfo(expected));
490 } 485 }
491 } 486 }
492 } // namespace 487 } // namespace
493 } // namespace vcm 488 } // namespace vcm
494 } // namespace webrtc 489 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/video_sender.cc ('k') | webrtc/video/video_receive_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698