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> | 10 #include <algorithm> |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 void VerifyHistogramStats(bool use_rtx, bool use_red, bool screenshare); | 123 void VerifyHistogramStats(bool use_rtx, bool use_red, bool screenshare); |
124 void VerifyNewVideoSendStreamsRespectNetworkState( | 124 void VerifyNewVideoSendStreamsRespectNetworkState( |
125 MediaType network_to_bring_down, | 125 MediaType network_to_bring_down, |
126 VideoEncoder* encoder, | 126 VideoEncoder* encoder, |
127 Transport* transport); | 127 Transport* transport); |
128 void VerifyNewVideoReceiveStreamsRespectNetworkState( | 128 void VerifyNewVideoReceiveStreamsRespectNetworkState( |
129 MediaType network_to_bring_down, | 129 MediaType network_to_bring_down, |
130 Transport* transport); | 130 Transport* transport); |
131 }; | 131 }; |
132 | 132 |
| 133 void SetPacketizationMode(H264PacketizationMode mode, VideoEncoder* encoder) { |
| 134 VideoCodec codec_settings; |
| 135 codec_settings.codecType = kVideoCodecH264; |
| 136 codec_settings.H264()->packetization_mode = mode; |
| 137 // TODO(hta): Determine appropriate value for max packet size. |
| 138 static const int kMaxPacketSize = 1024; |
| 139 encoder->InitEncode(&codec_settings, 0, kMaxPacketSize); |
| 140 } |
| 141 |
133 TEST_F(EndToEndTest, ReceiverCanBeStartedTwice) { | 142 TEST_F(EndToEndTest, ReceiverCanBeStartedTwice) { |
134 CreateCalls(Call::Config(&event_log_), Call::Config(&event_log_)); | 143 CreateCalls(Call::Config(&event_log_), Call::Config(&event_log_)); |
135 | 144 |
136 test::NullTransport transport; | 145 test::NullTransport transport; |
137 CreateSendConfig(1, 0, &transport); | 146 CreateSendConfig(1, 0, &transport); |
138 CreateMatchingReceiveConfigs(&transport); | 147 CreateMatchingReceiveConfigs(&transport); |
139 | 148 |
140 CreateVideoStreams(); | 149 CreateVideoStreams(); |
141 | 150 |
142 video_receive_streams_[0]->Start(); | 151 video_receive_streams_[0]->Start(); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 } | 377 } |
369 | 378 |
370 TEST_F(EndToEndTest, SendsAndReceivesVP9VideoRotation90) { | 379 TEST_F(EndToEndTest, SendsAndReceivesVP9VideoRotation90) { |
371 CodecObserver test(5, kVideoRotation_90, "VP9", | 380 CodecObserver test(5, kVideoRotation_90, "VP9", |
372 VideoEncoder::Create(VideoEncoder::kVp9), | 381 VideoEncoder::Create(VideoEncoder::kVp9), |
373 VP9Decoder::Create()); | 382 VP9Decoder::Create()); |
374 RunBaseTest(&test); | 383 RunBaseTest(&test); |
375 } | 384 } |
376 #endif // !defined(RTC_DISABLE_VP9) | 385 #endif // !defined(RTC_DISABLE_VP9) |
377 | 386 |
378 #if defined(WEBRTC_END_TO_END_H264_TESTS) | 387 #if defined(WEBRTC_USE_H264) |
379 | 388 |
380 TEST_F(EndToEndTest, SendsAndReceivesH264) { | 389 TEST_F(EndToEndTest, SendsAndReceivesH264) { |
381 CodecObserver test(500, kVideoRotation_0, "H264", | 390 CodecObserver test(500, kVideoRotation_0, "H264", |
382 VideoEncoder::Create(VideoEncoder::kH264), | 391 VideoEncoder::Create(VideoEncoder::kH264), |
383 H264Decoder::Create()); | 392 H264Decoder::Create()); |
384 RunBaseTest(&test); | 393 RunBaseTest(&test); |
385 } | 394 } |
386 | 395 |
387 TEST_F(EndToEndTest, SendsAndReceivesH264VideoRotation90) { | 396 TEST_F(EndToEndTest, SendsAndReceivesH264VideoRotation90) { |
388 CodecObserver test(5, kVideoRotation_90, "H264", | 397 CodecObserver test(5, kVideoRotation_90, "H264", |
389 VideoEncoder::Create(VideoEncoder::kH264), | 398 VideoEncoder::Create(VideoEncoder::kH264), |
390 H264Decoder::Create()); | 399 H264Decoder::Create()); |
391 RunBaseTest(&test); | 400 RunBaseTest(&test); |
392 } | 401 } |
393 | 402 |
394 #endif // defined(WEBRTC_END_TO_END_H264_TESTS) | 403 TEST_F(EndToEndTest, SendsAndReceivesH264PacketizationMode0) { |
| 404 VideoEncoder* encoder = VideoEncoder::Create(VideoEncoder::kH264); |
| 405 SetPacketizationMode(kH264PacketizationMode0, encoder); |
| 406 // The CodecObserver takes ownership of the encoder. |
| 407 CodecObserver test(500, kVideoRotation_0, "H264", encoder, |
| 408 H264Decoder::Create()); |
| 409 RunBaseTest(&test); |
| 410 } |
| 411 |
| 412 TEST_F(EndToEndTest, SendsAndReceivesH264PacketizationMode1) { |
| 413 VideoEncoder* encoder = VideoEncoder::Create(VideoEncoder::kH264); |
| 414 SetPacketizationMode(kH264PacketizationMode1, encoder); |
| 415 // The CodecObserver takes ownership of the encoder. |
| 416 CodecObserver test(500, kVideoRotation_0, "H264", encoder, |
| 417 H264Decoder::Create()); |
| 418 RunBaseTest(&test); |
| 419 } |
| 420 |
| 421 #endif // defined(WEBRTC_USE_H264) |
395 | 422 |
396 TEST_F(EndToEndTest, ReceiverUsesLocalSsrc) { | 423 TEST_F(EndToEndTest, ReceiverUsesLocalSsrc) { |
397 class SyncRtcpObserver : public test::EndToEndTest { | 424 class SyncRtcpObserver : public test::EndToEndTest { |
398 public: | 425 public: |
399 SyncRtcpObserver() : EndToEndTest(kDefaultTimeoutMs) {} | 426 SyncRtcpObserver() : EndToEndTest(kDefaultTimeoutMs) {} |
400 | 427 |
401 Action OnReceiveRtcp(const uint8_t* packet, size_t length) override { | 428 Action OnReceiveRtcp(const uint8_t* packet, size_t length) override { |
402 test::RtcpPacketParser parser; | 429 test::RtcpPacketParser parser; |
403 EXPECT_TRUE(parser.Parse(packet, length)); | 430 EXPECT_TRUE(parser.Parse(packet, length)); |
404 EXPECT_EQ(kReceiverLocalVideoSsrc, parser.sender_ssrc()); | 431 EXPECT_EQ(kReceiverLocalVideoSsrc, parser.sender_ssrc()); |
(...skipping 3504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3909 std::unique_ptr<VideoEncoder> encoder_; | 3936 std::unique_ptr<VideoEncoder> encoder_; |
3910 std::unique_ptr<VideoDecoder> decoder_; | 3937 std::unique_ptr<VideoDecoder> decoder_; |
3911 rtc::CriticalSection crit_; | 3938 rtc::CriticalSection crit_; |
3912 int recorded_frames_ GUARDED_BY(crit_); | 3939 int recorded_frames_ GUARDED_BY(crit_); |
3913 } test(this); | 3940 } test(this); |
3914 | 3941 |
3915 RunBaseTest(&test); | 3942 RunBaseTest(&test); |
3916 } | 3943 } |
3917 | 3944 |
3918 } // namespace webrtc | 3945 } // namespace webrtc |
OLD | NEW |