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

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: Created 4 years, 9 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
11 #include <algorithm>
11 #include <memory> 12 #include <memory>
12 #include <vector> 13 #include <vector>
13 14
14 #include "testing/gmock/include/gmock/gmock.h" 15 #include "testing/gmock/include/gmock/gmock.h"
15 #include "webrtc/modules/video_coding/include/video_codec_interface.h" 16 #include "webrtc/modules/video_coding/include/video_codec_interface.h"
16 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h" 17 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h"
17 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_unittest.h" 18 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_unittest.h"
18 19
19 namespace webrtc { 20 namespace webrtc {
20 namespace testing { 21 namespace testing {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 VideoEncoder* Create() override { 168 VideoEncoder* Create() override {
168 MockVideoEncoder* encoder = new MockVideoEncoder(); 169 MockVideoEncoder* encoder = new MockVideoEncoder();
169 const char* encoder_name = encoder_names_.empty() 170 const char* encoder_name = encoder_names_.empty()
170 ? "codec_implementation_name" 171 ? "codec_implementation_name"
171 : encoder_names_[encoders_.size()]; 172 : encoder_names_[encoders_.size()];
172 ON_CALL(*encoder, ImplementationName()).WillByDefault(Return(encoder_name)); 173 ON_CALL(*encoder, ImplementationName()).WillByDefault(Return(encoder_name));
173 encoders_.push_back(encoder); 174 encoders_.push_back(encoder);
174 return encoder; 175 return encoder;
175 } 176 }
176 177
177 void Destroy(VideoEncoder* encoder) override { delete encoder; } 178 void Destroy(VideoEncoder* encoder) override {
179 encoders_.erase(std::remove(encoders_.begin(), encoders_.end(), encoder));
stefan-webrtc 2016/03/30 13:07:08 This looks weird to me. Why would you want to remo
pbos-webrtc 2016/03/30 13:51:29 Removed the std::remove part and wrote it myself,
180 delete encoder;
181 }
178 182
179 virtual ~MockVideoEncoderFactory() {} 183 virtual ~MockVideoEncoderFactory() {}
180 184
181 const std::vector<MockVideoEncoder*>& encoders() const { return encoders_; } 185 const std::vector<MockVideoEncoder*>& encoders() const { return encoders_; }
182 void SetEncoderNames(const std::vector<const char*>& encoder_names) { 186 void SetEncoderNames(const std::vector<const char*>& encoder_names) {
183 encoder_names_ = encoder_names; 187 encoder_names_ = encoder_names;
184 } 188 }
185 189
186 private: 190 private:
187 std::vector<MockVideoEncoder*> encoders_; 191 std::vector<MockVideoEncoder*> encoders_;
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 TestVp8Simulcast::DefaultSettings( 418 TestVp8Simulcast::DefaultSettings(
415 &codec_, static_cast<const int*>(kTestTemporalLayerProfile)); 419 &codec_, static_cast<const int*>(kTestTemporalLayerProfile));
416 std::vector<const char*> encoder_names; 420 std::vector<const char*> encoder_names;
417 encoder_names.push_back("codec1"); 421 encoder_names.push_back("codec1");
418 encoder_names.push_back("codec2"); 422 encoder_names.push_back("codec2");
419 encoder_names.push_back("codec3"); 423 encoder_names.push_back("codec3");
420 helper_->factory()->SetEncoderNames(encoder_names); 424 helper_->factory()->SetEncoderNames(encoder_names);
421 EXPECT_EQ(0, adapter_->InitEncode(&codec_, 1, 1200)); 425 EXPECT_EQ(0, adapter_->InitEncode(&codec_, 1, 1200));
422 EXPECT_STREQ("SimulcastEncoderAdapter (codec1, codec2, codec3)", 426 EXPECT_STREQ("SimulcastEncoderAdapter (codec1, codec2, codec3)",
423 adapter_->ImplementationName()); 427 adapter_->ImplementationName());
428
429 // Single streams should not expose "SimulcastEncoderAdapter" in name.
430 adapter_->Release();
431 codec_.numberOfSimulcastStreams = 1;
432 EXPECT_EQ(0, adapter_->InitEncode(&codec_, 1, 1200));
433 adapter_->RegisterEncodeCompleteCallback(this);
434 ASSERT_EQ(1u, helper_->factory()->encoders().size());
435 EXPECT_STREQ("codec1", adapter_->ImplementationName());
424 } 436 }
425 437
426 TEST_F(TestSimulcastEncoderAdapterFake, 438 TEST_F(TestSimulcastEncoderAdapterFake,
427 SupportsNativeHandleDisabledForMultipleStreams) { 439 SupportsNativeHandleDisabledForMultipleStreams) {
428 // TODO(pbos): Implement actual test (verify that it works) when implemented 440 // TODO(pbos): Implement actual test (verify that it works) when implemented
429 // for multiple streams. 441 // for multiple streams.
430 TestVp8Simulcast::DefaultSettings( 442 TestVp8Simulcast::DefaultSettings(
431 &codec_, static_cast<const int*>(kTestTemporalLayerProfile)); 443 &codec_, static_cast<const int*>(kTestTemporalLayerProfile));
432 codec_.numberOfSimulcastStreams = 3; 444 codec_.numberOfSimulcastStreams = 3;
433 EXPECT_EQ(0, adapter_->InitEncode(&codec_, 1, 1200)); 445 EXPECT_EQ(0, adapter_->InitEncode(&codec_, 1, 1200));
434 adapter_->RegisterEncodeCompleteCallback(this); 446 adapter_->RegisterEncodeCompleteCallback(this);
435 ASSERT_EQ(3u, helper_->factory()->encoders().size()); 447 ASSERT_EQ(3u, helper_->factory()->encoders().size());
436 for (MockVideoEncoder* encoder : helper_->factory()->encoders()) 448 for (MockVideoEncoder* encoder : helper_->factory()->encoders())
437 encoder->set_supports_native_handle(true); 449 encoder->set_supports_native_handle(true);
438 EXPECT_FALSE(adapter_->SupportsNativeHandle()); 450 EXPECT_FALSE(adapter_->SupportsNativeHandle());
439 } 451 }
440 452
441 } // namespace testing 453 } // namespace testing
442 } // namespace webrtc 454 } // 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