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 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1425 RTC_DCHECK(observer_); | 1425 RTC_DCHECK(observer_); |
1426 EXPECT_TRUE(observer_->Wait()); | 1426 EXPECT_TRUE(observer_->Wait()); |
1427 } | 1427 } |
1428 | 1428 |
1429 void UpdateSendConfig( | 1429 void UpdateSendConfig( |
1430 size_t stream_index, | 1430 size_t stream_index, |
1431 VideoSendStream::Config* send_config, | 1431 VideoSendStream::Config* send_config, |
1432 VideoEncoderConfig* encoder_config, | 1432 VideoEncoderConfig* encoder_config, |
1433 test::FrameGeneratorCapturer** frame_generator) override { | 1433 test::FrameGeneratorCapturer** frame_generator) override { |
1434 send_config->rtp.extensions.clear(); | 1434 send_config->rtp.extensions.clear(); |
1435 send_config->rtp.extensions.push_back( | 1435 send_config->rtp.extensions.push_back(RtpExtension( |
1436 RtpExtension(RtpExtension::kTransportSequenceNumber, kExtensionId)); | 1436 RtpExtension::kTransportSequenceNumberUri, kExtensionId)); |
1437 | 1437 |
1438 // Force some padding to be sent. | 1438 // Force some padding to be sent. |
1439 const int kPaddingBitrateBps = 50000; | 1439 const int kPaddingBitrateBps = 50000; |
1440 int total_target_bitrate = 0; | 1440 int total_target_bitrate = 0; |
1441 for (const VideoStream& stream : encoder_config->streams) | 1441 for (const VideoStream& stream : encoder_config->streams) |
1442 total_target_bitrate += stream.target_bitrate_bps; | 1442 total_target_bitrate += stream.target_bitrate_bps; |
1443 encoder_config->min_transmit_bitrate_bps = | 1443 encoder_config->min_transmit_bitrate_bps = |
1444 total_target_bitrate + kPaddingBitrateBps; | 1444 total_target_bitrate + kPaddingBitrateBps; |
1445 | 1445 |
1446 // Configure RTX for redundant payload padding. | 1446 // Configure RTX for redundant payload padding. |
1447 send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 1447 send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
1448 send_config->rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[stream_index]); | 1448 send_config->rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[stream_index]); |
1449 send_config->rtp.rtx.payload_type = kSendRtxPayloadType; | 1449 send_config->rtp.rtx.payload_type = kSendRtxPayloadType; |
1450 rtx_to_media_ssrcs_[kSendRtxSsrcs[stream_index]] = | 1450 rtx_to_media_ssrcs_[kSendRtxSsrcs[stream_index]] = |
1451 send_config->rtp.ssrcs[0]; | 1451 send_config->rtp.ssrcs[0]; |
1452 | 1452 |
1453 if (stream_index == 0) | 1453 if (stream_index == 0) |
1454 first_media_ssrc_ = send_config->rtp.ssrcs[0]; | 1454 first_media_ssrc_ = send_config->rtp.ssrcs[0]; |
1455 } | 1455 } |
1456 | 1456 |
1457 void UpdateReceiveConfig( | 1457 void UpdateReceiveConfig( |
1458 size_t stream_index, | 1458 size_t stream_index, |
1459 VideoReceiveStream::Config* receive_config) override { | 1459 VideoReceiveStream::Config* receive_config) override { |
1460 receive_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 1460 receive_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
1461 receive_config->rtp.extensions.clear(); | 1461 receive_config->rtp.extensions.clear(); |
1462 receive_config->rtp.extensions.push_back( | 1462 receive_config->rtp.extensions.push_back(RtpExtension( |
1463 RtpExtension(RtpExtension::kTransportSequenceNumber, kExtensionId)); | 1463 RtpExtension::kTransportSequenceNumberUri, kExtensionId)); |
1464 } | 1464 } |
1465 | 1465 |
1466 test::DirectTransport* CreateSendTransport(Call* sender_call) override { | 1466 test::DirectTransport* CreateSendTransport(Call* sender_call) override { |
1467 observer_ = new RtpExtensionHeaderObserver(sender_call, first_media_ssrc_, | 1467 observer_ = new RtpExtensionHeaderObserver(sender_call, first_media_ssrc_, |
1468 rtx_to_media_ssrcs_); | 1468 rtx_to_media_ssrcs_); |
1469 return observer_; | 1469 return observer_; |
1470 } | 1470 } |
1471 | 1471 |
1472 private: | 1472 private: |
1473 uint32_t first_media_ssrc_; | 1473 uint32_t first_media_ssrc_; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1532 | 1532 |
1533 size_t GetNumVideoStreams() const override { return num_video_streams_; } | 1533 size_t GetNumVideoStreams() const override { return num_video_streams_; } |
1534 size_t GetNumAudioStreams() const override { return num_audio_streams_; } | 1534 size_t GetNumAudioStreams() const override { return num_audio_streams_; } |
1535 | 1535 |
1536 void ModifyVideoConfigs( | 1536 void ModifyVideoConfigs( |
1537 VideoSendStream::Config* send_config, | 1537 VideoSendStream::Config* send_config, |
1538 std::vector<VideoReceiveStream::Config>* receive_configs, | 1538 std::vector<VideoReceiveStream::Config>* receive_configs, |
1539 VideoEncoderConfig* encoder_config) override { | 1539 VideoEncoderConfig* encoder_config) override { |
1540 send_config->rtp.extensions.clear(); | 1540 send_config->rtp.extensions.clear(); |
1541 send_config->rtp.extensions.push_back( | 1541 send_config->rtp.extensions.push_back( |
1542 RtpExtension(RtpExtension::kTransportSequenceNumber, kExtensionId)); | 1542 RtpExtension(RtpExtension::kTransportSequenceNumberUri, kExtensionId)); |
1543 (*receive_configs)[0].rtp.extensions = send_config->rtp.extensions; | 1543 (*receive_configs)[0].rtp.extensions = send_config->rtp.extensions; |
1544 (*receive_configs)[0].rtp.transport_cc = feedback_enabled_; | 1544 (*receive_configs)[0].rtp.transport_cc = feedback_enabled_; |
1545 } | 1545 } |
1546 | 1546 |
1547 void ModifyAudioConfigs( | 1547 void ModifyAudioConfigs( |
1548 AudioSendStream::Config* send_config, | 1548 AudioSendStream::Config* send_config, |
1549 std::vector<AudioReceiveStream::Config>* receive_configs) override { | 1549 std::vector<AudioReceiveStream::Config>* receive_configs) override { |
1550 send_config->rtp.extensions.clear(); | 1550 send_config->rtp.extensions.clear(); |
1551 send_config->rtp.extensions.push_back( | 1551 send_config->rtp.extensions.push_back( |
1552 RtpExtension(RtpExtension::kTransportSequenceNumber, kExtensionId)); | 1552 RtpExtension(RtpExtension::kTransportSequenceNumberUri, kExtensionId)); |
1553 (*receive_configs)[0].rtp.extensions.clear(); | 1553 (*receive_configs)[0].rtp.extensions.clear(); |
1554 (*receive_configs)[0].rtp.extensions = send_config->rtp.extensions; | 1554 (*receive_configs)[0].rtp.extensions = send_config->rtp.extensions; |
1555 (*receive_configs)[0].rtp.transport_cc = feedback_enabled_; | 1555 (*receive_configs)[0].rtp.transport_cc = feedback_enabled_; |
1556 } | 1556 } |
1557 | 1557 |
1558 private: | 1558 private: |
1559 static const int kExtensionId = 5; | 1559 static const int kExtensionId = 5; |
1560 const bool feedback_enabled_; | 1560 const bool feedback_enabled_; |
1561 const size_t num_video_streams_; | 1561 const size_t num_video_streams_; |
1562 const size_t num_audio_streams_; | 1562 const size_t num_audio_streams_; |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1780 return config; | 1780 return config; |
1781 } | 1781 } |
1782 | 1782 |
1783 void ModifyVideoConfigs( | 1783 void ModifyVideoConfigs( |
1784 VideoSendStream::Config* send_config, | 1784 VideoSendStream::Config* send_config, |
1785 std::vector<VideoReceiveStream::Config>* receive_configs, | 1785 std::vector<VideoReceiveStream::Config>* receive_configs, |
1786 VideoEncoderConfig* encoder_config) override { | 1786 VideoEncoderConfig* encoder_config) override { |
1787 ASSERT_EQ(1u, send_config->rtp.ssrcs.size()); | 1787 ASSERT_EQ(1u, send_config->rtp.ssrcs.size()); |
1788 send_config->rtp.extensions.clear(); | 1788 send_config->rtp.extensions.clear(); |
1789 send_config->rtp.extensions.push_back( | 1789 send_config->rtp.extensions.push_back( |
1790 RtpExtension(RtpExtension::kTransportSequenceNumber, | 1790 RtpExtension(RtpExtension::kTransportSequenceNumberUri, |
1791 test::kTransportSequenceNumberExtensionId)); | 1791 test::kTransportSequenceNumberExtensionId)); |
1792 sender_ssrc_ = send_config->rtp.ssrcs[0]; | 1792 sender_ssrc_ = send_config->rtp.ssrcs[0]; |
1793 | 1793 |
1794 encoder_config->streams[0].max_bitrate_bps = | 1794 encoder_config->streams[0].max_bitrate_bps = |
1795 encoder_config->streams[0].target_bitrate_bps = 2000000; | 1795 encoder_config->streams[0].target_bitrate_bps = 2000000; |
1796 | 1796 |
1797 ASSERT_EQ(1u, receive_configs->size()); | 1797 ASSERT_EQ(1u, receive_configs->size()); |
1798 (*receive_configs)[0].rtp.remb = false; | 1798 (*receive_configs)[0].rtp.remb = false; |
1799 (*receive_configs)[0].rtp.transport_cc = true; | 1799 (*receive_configs)[0].rtp.transport_cc = true; |
1800 (*receive_configs)[0].rtp.extensions = send_config->rtp.extensions; | 1800 (*receive_configs)[0].rtp.extensions = send_config->rtp.extensions; |
(...skipping 1644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3445 } | 3445 } |
3446 | 3446 |
3447 size_t GetNumVideoStreams() const override { return 1; } | 3447 size_t GetNumVideoStreams() const override { return 1; } |
3448 size_t GetNumAudioStreams() const override { return 1; } | 3448 size_t GetNumAudioStreams() const override { return 1; } |
3449 | 3449 |
3450 void ModifyVideoConfigs( | 3450 void ModifyVideoConfigs( |
3451 VideoSendStream::Config* send_config, | 3451 VideoSendStream::Config* send_config, |
3452 std::vector<VideoReceiveStream::Config>* receive_configs, | 3452 std::vector<VideoReceiveStream::Config>* receive_configs, |
3453 VideoEncoderConfig* encoder_config) override { | 3453 VideoEncoderConfig* encoder_config) override { |
3454 send_config->rtp.extensions.clear(); | 3454 send_config->rtp.extensions.clear(); |
3455 send_config->rtp.extensions.push_back( | 3455 send_config->rtp.extensions.push_back(RtpExtension( |
3456 RtpExtension(RtpExtension::kTransportSequenceNumber, kExtensionId)); | 3456 RtpExtension::kTransportSequenceNumberUri, kExtensionId)); |
3457 (*receive_configs)[0].rtp.extensions = send_config->rtp.extensions; | 3457 (*receive_configs)[0].rtp.extensions = send_config->rtp.extensions; |
3458 } | 3458 } |
3459 | 3459 |
3460 void ModifyAudioConfigs( | 3460 void ModifyAudioConfigs( |
3461 AudioSendStream::Config* send_config, | 3461 AudioSendStream::Config* send_config, |
3462 std::vector<AudioReceiveStream::Config>* receive_configs) override { | 3462 std::vector<AudioReceiveStream::Config>* receive_configs) override { |
3463 send_config->rtp.extensions.clear(); | 3463 send_config->rtp.extensions.clear(); |
3464 send_config->rtp.extensions.push_back( | 3464 send_config->rtp.extensions.push_back(RtpExtension( |
3465 RtpExtension(RtpExtension::kTransportSequenceNumber, kExtensionId)); | 3465 RtpExtension::kTransportSequenceNumberUri, kExtensionId)); |
3466 (*receive_configs)[0].rtp.extensions.clear(); | 3466 (*receive_configs)[0].rtp.extensions.clear(); |
3467 (*receive_configs)[0].rtp.extensions = send_config->rtp.extensions; | 3467 (*receive_configs)[0].rtp.extensions = send_config->rtp.extensions; |
3468 } | 3468 } |
3469 | 3469 |
3470 Action OnSendRtp(const uint8_t* packet, size_t length) override { | 3470 Action OnSendRtp(const uint8_t* packet, size_t length) override { |
3471 RTPHeader header; | 3471 RTPHeader header; |
3472 EXPECT_TRUE(parser_->Parse(packet, length, &header)); | 3472 EXPECT_TRUE(parser_->Parse(packet, length, &header)); |
3473 EXPECT_TRUE(header.extension.hasTransportSequenceNumber); | 3473 EXPECT_TRUE(header.extension.hasTransportSequenceNumber); |
3474 // Unwrap packet id and verify uniqueness. | 3474 // Unwrap packet id and verify uniqueness. |
3475 int64_t packet_id = | 3475 int64_t packet_id = |
(...skipping 22 matching lines...) Expand all Loading... |
3498 private: | 3498 private: |
3499 bool video_observed_; | 3499 bool video_observed_; |
3500 bool audio_observed_; | 3500 bool audio_observed_; |
3501 SequenceNumberUnwrapper unwrapper_; | 3501 SequenceNumberUnwrapper unwrapper_; |
3502 std::set<int64_t> received_packet_ids_; | 3502 std::set<int64_t> received_packet_ids_; |
3503 } test; | 3503 } test; |
3504 | 3504 |
3505 RunBaseTest(&test); | 3505 RunBaseTest(&test); |
3506 } | 3506 } |
3507 } // namespace webrtc | 3507 } // namespace webrtc |
OLD | NEW |