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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 } | 284 } |
285 | 285 |
286 void PerformTest() override { | 286 void PerformTest() override { |
287 EXPECT_TRUE(Wait()) << "Timed out while waiting for single RTP packet."; | 287 EXPECT_TRUE(Wait()) << "Timed out while waiting for single RTP packet."; |
288 } | 288 } |
289 } test; | 289 } test; |
290 | 290 |
291 RunBaseTest(&test); | 291 RunBaseTest(&test); |
292 } | 292 } |
293 | 293 |
| 294 TEST_F(VideoSendStreamTest, SupportsVideoContentType) { |
| 295 class VideoRotationObserver : public test::SendTest { |
| 296 public: |
| 297 VideoRotationObserver() : SendTest(kDefaultTimeoutMs) { |
| 298 EXPECT_TRUE(parser_->RegisterRtpHeaderExtension( |
| 299 kRtpExtensionVideoContentType, test::kVideoContentTypeExtensionId)); |
| 300 } |
| 301 |
| 302 Action OnSendRtp(const uint8_t* packet, size_t length) override { |
| 303 RTPHeader header; |
| 304 EXPECT_TRUE(parser_->Parse(packet, length, &header)); |
| 305 EXPECT_TRUE(header.extension.hasVideoContentType); |
| 306 EXPECT_EQ(kVideoContent_Screenshare, header.extension.videoContentType); |
| 307 observation_complete_.Set(); |
| 308 return SEND_PACKET; |
| 309 } |
| 310 |
| 311 void ModifyVideoConfigs( |
| 312 VideoSendStream::Config* send_config, |
| 313 std::vector<VideoReceiveStream::Config>* receive_configs, |
| 314 VideoEncoderConfig* encoder_config) override { |
| 315 send_config->rtp.extensions.clear(); |
| 316 send_config->rtp.extensions.push_back( |
| 317 RtpExtension(RtpExtension::kVideoContentTypeUri, |
| 318 test::kVideoContentTypeExtensionId)); |
| 319 } |
| 320 |
| 321 void OnFrameGeneratorCapturerCreated( |
| 322 test::FrameGeneratorCapturer* frame_generator_capturer) override { |
| 323 frame_generator_capturer->SetFakeContentType(kVideoContent_Screenshare); |
| 324 } |
| 325 |
| 326 void PerformTest() override { |
| 327 EXPECT_TRUE(Wait()) << "Timed out while waiting for single RTP packet."; |
| 328 } |
| 329 } test; |
| 330 |
| 331 RunBaseTest(&test); |
| 332 } |
| 333 |
294 class FakeReceiveStatistics : public NullReceiveStatistics { | 334 class FakeReceiveStatistics : public NullReceiveStatistics { |
295 public: | 335 public: |
296 FakeReceiveStatistics(uint32_t send_ssrc, | 336 FakeReceiveStatistics(uint32_t send_ssrc, |
297 uint32_t last_sequence_number, | 337 uint32_t last_sequence_number, |
298 uint32_t cumulative_lost, | 338 uint32_t cumulative_lost, |
299 uint8_t fraction_lost) | 339 uint8_t fraction_lost) |
300 : lossy_stats_(new LossyStatistician(last_sequence_number, | 340 : lossy_stats_(new LossyStatistician(last_sequence_number, |
301 cumulative_lost, | 341 cumulative_lost, |
302 fraction_lost)) { | 342 fraction_lost)) { |
303 stats_map_[send_ssrc] = lossy_stats_.get(); | 343 stats_map_[send_ssrc] = lossy_stats_.get(); |
(...skipping 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1966 EXPECT_TRUE(test::FrameBufsEqual(frames1[i].video_frame_buffer(), | 2006 EXPECT_TRUE(test::FrameBufsEqual(frames1[i].video_frame_buffer(), |
1967 frames2[i].video_frame_buffer())); | 2007 frames2[i].video_frame_buffer())); |
1968 } | 2008 } |
1969 | 2009 |
1970 VideoFrame CreateVideoFrame(int width, int height, uint8_t data) { | 2010 VideoFrame CreateVideoFrame(int width, int height, uint8_t data) { |
1971 const int kSizeY = width * height * 2; | 2011 const int kSizeY = width * height * 2; |
1972 std::unique_ptr<uint8_t[]> buffer(new uint8_t[kSizeY]); | 2012 std::unique_ptr<uint8_t[]> buffer(new uint8_t[kSizeY]); |
1973 memset(buffer.get(), data, kSizeY); | 2013 memset(buffer.get(), data, kSizeY); |
1974 VideoFrame frame( | 2014 VideoFrame frame( |
1975 I420Buffer::Create(width, height, width, width / 2, width / 2), | 2015 I420Buffer::Create(width, height, width, width / 2, width / 2), |
1976 kVideoRotation_0, data); | 2016 kVideoRotation_0, kVideoContent_Default, data); |
1977 frame.set_timestamp(data); | 2017 frame.set_timestamp(data); |
1978 // Use data as a ms timestamp. | 2018 // Use data as a ms timestamp. |
1979 frame.set_timestamp_us(data * rtc::kNumMicrosecsPerMillisec); | 2019 frame.set_timestamp_us(data * rtc::kNumMicrosecsPerMillisec); |
1980 return frame; | 2020 return frame; |
1981 } | 2021 } |
1982 | 2022 |
1983 TEST_F(VideoSendStreamTest, EncoderIsProperlyInitializedAndDestroyed) { | 2023 TEST_F(VideoSendStreamTest, EncoderIsProperlyInitializedAndDestroyed) { |
1984 class EncoderStateObserver : public test::SendTest, public VideoEncoder { | 2024 class EncoderStateObserver : public test::SendTest, public VideoEncoder { |
1985 public: | 2025 public: |
1986 EncoderStateObserver() | 2026 EncoderStateObserver() |
(...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3284 rtc::CriticalSection crit_; | 3324 rtc::CriticalSection crit_; |
3285 uint32_t max_bitrate_bps_ GUARDED_BY(&crit_); | 3325 uint32_t max_bitrate_bps_ GUARDED_BY(&crit_); |
3286 bool first_packet_sent_ GUARDED_BY(&crit_); | 3326 bool first_packet_sent_ GUARDED_BY(&crit_); |
3287 rtc::Event bitrate_changed_event_; | 3327 rtc::Event bitrate_changed_event_; |
3288 } test; | 3328 } test; |
3289 | 3329 |
3290 RunBaseTest(&test); | 3330 RunBaseTest(&test); |
3291 } | 3331 } |
3292 | 3332 |
3293 } // namespace webrtc | 3333 } // namespace webrtc |
OLD | NEW |