OLD | NEW |
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 #include <algorithm> // max | 10 #include <algorithm> // max |
(...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1531 const char* const codec_name_; | 1531 const char* const codec_name_; |
1532 rtc::Event init_encode_event_; | 1532 rtc::Event init_encode_event_; |
1533 size_t num_initializations_; | 1533 size_t num_initializations_; |
1534 VideoSendStream* stream_; | 1534 VideoSendStream* stream_; |
1535 VideoEncoderConfig encoder_config_; | 1535 VideoEncoderConfig encoder_config_; |
1536 }; | 1536 }; |
1537 | 1537 |
1538 template <> | 1538 template <> |
1539 void VideoCodecConfigObserver<VideoCodecH264>::VerifyCodecSpecifics( | 1539 void VideoCodecConfigObserver<VideoCodecH264>::VerifyCodecSpecifics( |
1540 const VideoCodec& config) const { | 1540 const VideoCodec& config) const { |
1541 EXPECT_EQ(0, memcmp(&config.codecSpecific.H264, &encoder_settings_, | 1541 EXPECT_EQ( |
1542 sizeof(encoder_settings_))); | 1542 0, memcmp(&config.H264(), &encoder_settings_, sizeof(encoder_settings_))); |
1543 } | 1543 } |
1544 template <> | 1544 template <> |
1545 void VideoCodecConfigObserver<VideoCodecVP8>::VerifyCodecSpecifics( | 1545 void VideoCodecConfigObserver<VideoCodecVP8>::VerifyCodecSpecifics( |
1546 const VideoCodec& config) const { | 1546 const VideoCodec& config) const { |
1547 // Check that the number of temporal layers has propagated properly to | 1547 // Check that the number of temporal layers has propagated properly to |
1548 // VideoCodec. | 1548 // VideoCodec. |
1549 EXPECT_EQ(kVideoCodecConfigObserverNumberOfTemporalLayers, | 1549 EXPECT_EQ(kVideoCodecConfigObserverNumberOfTemporalLayers, |
1550 config.codecSpecific.VP8.numberOfTemporalLayers); | 1550 config.VP8().numberOfTemporalLayers); |
1551 | 1551 |
1552 for (unsigned char i = 0; i < config.numberOfSimulcastStreams; ++i) { | 1552 for (unsigned char i = 0; i < config.numberOfSimulcastStreams; ++i) { |
1553 EXPECT_EQ(kVideoCodecConfigObserverNumberOfTemporalLayers, | 1553 EXPECT_EQ(kVideoCodecConfigObserverNumberOfTemporalLayers, |
1554 config.simulcastStream[i].numberOfTemporalLayers); | 1554 config.simulcastStream[i].numberOfTemporalLayers); |
1555 } | 1555 } |
1556 | 1556 |
1557 // Set expected temporal layers as they should have been set when | 1557 // Set expected temporal layers as they should have been set when |
1558 // reconfiguring the encoder and not match the set config. | 1558 // reconfiguring the encoder and not match the set config. |
1559 VideoCodecVP8 encoder_settings = encoder_settings_; | 1559 VideoCodecVP8 encoder_settings = encoder_settings_; |
1560 encoder_settings.numberOfTemporalLayers = | 1560 encoder_settings.numberOfTemporalLayers = |
1561 kVideoCodecConfigObserverNumberOfTemporalLayers; | 1561 kVideoCodecConfigObserverNumberOfTemporalLayers; |
1562 EXPECT_EQ(0, memcmp(&config.codecSpecific.VP8, &encoder_settings, | 1562 EXPECT_EQ( |
1563 sizeof(encoder_settings_))); | 1563 0, memcmp(&config.VP8(), &encoder_settings, sizeof(encoder_settings_))); |
1564 } | 1564 } |
1565 template <> | 1565 template <> |
1566 void VideoCodecConfigObserver<VideoCodecVP9>::VerifyCodecSpecifics( | 1566 void VideoCodecConfigObserver<VideoCodecVP9>::VerifyCodecSpecifics( |
1567 const VideoCodec& config) const { | 1567 const VideoCodec& config) const { |
1568 // Check that the number of temporal layers has propagated properly to | 1568 // Check that the number of temporal layers has propagated properly to |
1569 // VideoCodec. | 1569 // VideoCodec. |
1570 EXPECT_EQ(kVideoCodecConfigObserverNumberOfTemporalLayers, | 1570 EXPECT_EQ(kVideoCodecConfigObserverNumberOfTemporalLayers, |
1571 config.codecSpecific.VP9.numberOfTemporalLayers); | 1571 config.VP9().numberOfTemporalLayers); |
1572 | 1572 |
1573 for (unsigned char i = 0; i < config.numberOfSimulcastStreams; ++i) { | 1573 for (unsigned char i = 0; i < config.numberOfSimulcastStreams; ++i) { |
1574 EXPECT_EQ(kVideoCodecConfigObserverNumberOfTemporalLayers, | 1574 EXPECT_EQ(kVideoCodecConfigObserverNumberOfTemporalLayers, |
1575 config.simulcastStream[i].numberOfTemporalLayers); | 1575 config.simulcastStream[i].numberOfTemporalLayers); |
1576 } | 1576 } |
1577 | 1577 |
1578 // Set expected temporal layers as they should have been set when | 1578 // Set expected temporal layers as they should have been set when |
1579 // reconfiguring the encoder and not match the set config. | 1579 // reconfiguring the encoder and not match the set config. |
1580 VideoCodecVP9 encoder_settings = encoder_settings_; | 1580 VideoCodecVP9 encoder_settings = encoder_settings_; |
1581 encoder_settings.numberOfTemporalLayers = | 1581 encoder_settings.numberOfTemporalLayers = |
1582 kVideoCodecConfigObserverNumberOfTemporalLayers; | 1582 kVideoCodecConfigObserverNumberOfTemporalLayers; |
1583 EXPECT_EQ(0, memcmp(&config.codecSpecific.VP9, &encoder_settings, | 1583 EXPECT_EQ( |
1584 sizeof(encoder_settings_))); | 1584 0, memcmp(&(config.VP9()), &encoder_settings, sizeof(encoder_settings_))); |
1585 } | 1585 } |
1586 | 1586 |
1587 TEST_F(VideoSendStreamTest, EncoderSetupPropagatesVp8Config) { | 1587 TEST_F(VideoSendStreamTest, EncoderSetupPropagatesVp8Config) { |
1588 VideoCodecConfigObserver<VideoCodecVP8> test(kVideoCodecVP8, "VP8"); | 1588 VideoCodecConfigObserver<VideoCodecVP8> test(kVideoCodecVP8, "VP8"); |
1589 RunBaseTest(&test); | 1589 RunBaseTest(&test); |
1590 } | 1590 } |
1591 | 1591 |
1592 TEST_F(VideoSendStreamTest, EncoderSetupPropagatesVp9Config) { | 1592 TEST_F(VideoSendStreamTest, EncoderSetupPropagatesVp9Config) { |
1593 VideoCodecConfigObserver<VideoCodecVP9> test(kVideoCodecVP9, "VP9"); | 1593 VideoCodecConfigObserver<VideoCodecVP9> test(kVideoCodecVP9, "VP9"); |
1594 RunBaseTest(&test); | 1594 RunBaseTest(&test); |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2292 observation_complete_.Set(); | 2292 observation_complete_.Set(); |
2293 } | 2293 } |
2294 } | 2294 } |
2295 } test; | 2295 } test; |
2296 | 2296 |
2297 RunBaseTest(&test); | 2297 RunBaseTest(&test); |
2298 } | 2298 } |
2299 #endif // !defined(RTC_DISABLE_VP9) | 2299 #endif // !defined(RTC_DISABLE_VP9) |
2300 | 2300 |
2301 } // namespace webrtc | 2301 } // namespace webrtc |
OLD | NEW |