OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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 "webrtc/media/engine/webrtcvideoencoderfactory.h" | 11 #include "webrtc/media/engine/webrtcvideoencoderfactory.h" |
12 | 12 |
13 #include "webrtc/test/gtest.h" | 13 #include "webrtc/test/gtest.h" |
14 | 14 |
15 class WebRtcVideoEncoderFactoryForTest | 15 class WebRtcVideoEncoderFactoryForTest |
16 : public cricket::WebRtcVideoEncoderFactory { | 16 : public cricket::WebRtcVideoEncoderFactory { |
17 public: | 17 public: |
18 WebRtcVideoEncoderFactoryForTest() { | 18 WebRtcVideoEncoderFactoryForTest() { |
19 codecs_.push_back(VideoCodec(webrtc::kVideoCodecH264, "H264")); | 19 codecs_.push_back(cricket::VideoCodec("H264")); |
20 codecs_.push_back(VideoCodec(webrtc::kVideoCodecVP8, "VP8")); | 20 codecs_.push_back(cricket::VideoCodec("VP8")); |
21 } | 21 } |
22 | 22 |
23 const std::vector<VideoCodec>& codecs() const override { return codecs_; } | 23 webrtc::VideoEncoder* CreateVideoEncoder( |
| 24 const cricket::VideoCodec& codec) override { |
| 25 return nullptr; |
| 26 } |
| 27 |
| 28 const std::vector<cricket::VideoCodec>& supported_codecs() const override { |
| 29 return codecs_; |
| 30 } |
24 | 31 |
25 void DestroyVideoEncoder(webrtc::VideoEncoder* encoder) override {} | 32 void DestroyVideoEncoder(webrtc::VideoEncoder* encoder) override {} |
26 | 33 |
27 std::vector<VideoCodec> codecs_; | 34 std::vector<cricket::VideoCodec> codecs_; |
28 }; | 35 }; |
29 | 36 |
30 TEST(WebRtcVideoEncoderFactoryTest, TestMultipleCallsToSupportedCodecs) { | 37 TEST(WebRtcVideoEncoderFactoryTest, TestMultipleCallsToSupportedCodecs) { |
31 WebRtcVideoEncoderFactoryForTest factory; | 38 WebRtcVideoEncoderFactoryForTest factory; |
32 EXPECT_EQ(2u, factory.supported_codecs().size()); | 39 EXPECT_EQ(2u, factory.supported_codecs().size()); |
33 EXPECT_EQ("H264", factory.supported_codecs()[0].name); | 40 EXPECT_EQ("H264", factory.supported_codecs()[0].name); |
34 EXPECT_EQ("VP8", factory.supported_codecs()[1].name); | 41 EXPECT_EQ("VP8", factory.supported_codecs()[1].name); |
35 | 42 |
36 // The codec list doesn't grow when called repeatedly. | 43 // The codec list doesn't grow when called repeatedly. |
37 EXPECT_EQ(2u, factory.supported_codecs().size()); | 44 EXPECT_EQ(2u, factory.supported_codecs().size()); |
38 } | 45 } |
OLD | NEW |