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

Side by Side Diff: webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter_unittest.cc

Issue 1827553002: Shorten single-stream VP8 HW implementation names. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: remove std::remove part Created 4 years, 8 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
« no previous file with comments | « webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.cc ('k') | no next file » | 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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 VideoEncoder* Create() override { 167 VideoEncoder* Create() override {
168 MockVideoEncoder* encoder = new MockVideoEncoder(); 168 MockVideoEncoder* encoder = new MockVideoEncoder();
169 const char* encoder_name = encoder_names_.empty() 169 const char* encoder_name = encoder_names_.empty()
170 ? "codec_implementation_name" 170 ? "codec_implementation_name"
171 : encoder_names_[encoders_.size()]; 171 : encoder_names_[encoders_.size()];
172 ON_CALL(*encoder, ImplementationName()).WillByDefault(Return(encoder_name)); 172 ON_CALL(*encoder, ImplementationName()).WillByDefault(Return(encoder_name));
173 encoders_.push_back(encoder); 173 encoders_.push_back(encoder);
174 return encoder; 174 return encoder;
175 } 175 }
176 176
177 void Destroy(VideoEncoder* encoder) override { delete encoder; } 177 void Destroy(VideoEncoder* encoder) override {
178 for (size_t i = 0; i < encoders_.size(); ++i) {
179 if (encoders_[i] == encoder) {
180 encoders_.erase(encoders_.begin() + i);
181 break;
182 }
183 }
184 delete encoder;
185 }
178 186
179 virtual ~MockVideoEncoderFactory() {} 187 virtual ~MockVideoEncoderFactory() {}
180 188
181 const std::vector<MockVideoEncoder*>& encoders() const { return encoders_; } 189 const std::vector<MockVideoEncoder*>& encoders() const { return encoders_; }
182 void SetEncoderNames(const std::vector<const char*>& encoder_names) { 190 void SetEncoderNames(const std::vector<const char*>& encoder_names) {
183 encoder_names_ = encoder_names; 191 encoder_names_ = encoder_names;
184 } 192 }
185 193
186 private: 194 private:
187 std::vector<MockVideoEncoder*> encoders_; 195 std::vector<MockVideoEncoder*> encoders_;
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 TestVp8Simulcast::DefaultSettings( 422 TestVp8Simulcast::DefaultSettings(
415 &codec_, static_cast<const int*>(kTestTemporalLayerProfile)); 423 &codec_, static_cast<const int*>(kTestTemporalLayerProfile));
416 std::vector<const char*> encoder_names; 424 std::vector<const char*> encoder_names;
417 encoder_names.push_back("codec1"); 425 encoder_names.push_back("codec1");
418 encoder_names.push_back("codec2"); 426 encoder_names.push_back("codec2");
419 encoder_names.push_back("codec3"); 427 encoder_names.push_back("codec3");
420 helper_->factory()->SetEncoderNames(encoder_names); 428 helper_->factory()->SetEncoderNames(encoder_names);
421 EXPECT_EQ(0, adapter_->InitEncode(&codec_, 1, 1200)); 429 EXPECT_EQ(0, adapter_->InitEncode(&codec_, 1, 1200));
422 EXPECT_STREQ("SimulcastEncoderAdapter (codec1, codec2, codec3)", 430 EXPECT_STREQ("SimulcastEncoderAdapter (codec1, codec2, codec3)",
423 adapter_->ImplementationName()); 431 adapter_->ImplementationName());
432
433 // Single streams should not expose "SimulcastEncoderAdapter" in name.
434 adapter_->Release();
435 codec_.numberOfSimulcastStreams = 1;
436 EXPECT_EQ(0, adapter_->InitEncode(&codec_, 1, 1200));
437 adapter_->RegisterEncodeCompleteCallback(this);
438 ASSERT_EQ(1u, helper_->factory()->encoders().size());
439 EXPECT_STREQ("codec1", adapter_->ImplementationName());
424 } 440 }
425 441
426 TEST_F(TestSimulcastEncoderAdapterFake, 442 TEST_F(TestSimulcastEncoderAdapterFake,
427 SupportsNativeHandleDisabledForMultipleStreams) { 443 SupportsNativeHandleDisabledForMultipleStreams) {
428 // TODO(pbos): Implement actual test (verify that it works) when implemented 444 // TODO(pbos): Implement actual test (verify that it works) when implemented
429 // for multiple streams. 445 // for multiple streams.
430 TestVp8Simulcast::DefaultSettings( 446 TestVp8Simulcast::DefaultSettings(
431 &codec_, static_cast<const int*>(kTestTemporalLayerProfile)); 447 &codec_, static_cast<const int*>(kTestTemporalLayerProfile));
432 codec_.numberOfSimulcastStreams = 3; 448 codec_.numberOfSimulcastStreams = 3;
433 EXPECT_EQ(0, adapter_->InitEncode(&codec_, 1, 1200)); 449 EXPECT_EQ(0, adapter_->InitEncode(&codec_, 1, 1200));
434 adapter_->RegisterEncodeCompleteCallback(this); 450 adapter_->RegisterEncodeCompleteCallback(this);
435 ASSERT_EQ(3u, helper_->factory()->encoders().size()); 451 ASSERT_EQ(3u, helper_->factory()->encoders().size());
436 for (MockVideoEncoder* encoder : helper_->factory()->encoders()) 452 for (MockVideoEncoder* encoder : helper_->factory()->encoders())
437 encoder->set_supports_native_handle(true); 453 encoder->set_supports_native_handle(true);
438 EXPECT_FALSE(adapter_->SupportsNativeHandle()); 454 EXPECT_FALSE(adapter_->SupportsNativeHandle());
439 } 455 }
440 456
441 } // namespace testing 457 } // namespace testing
442 } // namespace webrtc 458 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698