| 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 }; | 190 }; |
| 191 | 191 |
| 192 void CallPerfTest::TestAudioVideoSync(bool fec, bool create_audio_first) { | 192 void CallPerfTest::TestAudioVideoSync(bool fec, bool create_audio_first) { |
| 193 const char* kSyncGroup = "av_sync"; | 193 const char* kSyncGroup = "av_sync"; |
| 194 class AudioPacketReceiver : public PacketReceiver { | 194 class AudioPacketReceiver : public PacketReceiver { |
| 195 public: | 195 public: |
| 196 AudioPacketReceiver(int channel, VoENetwork* voe_network) | 196 AudioPacketReceiver(int channel, VoENetwork* voe_network) |
| 197 : channel_(channel), | 197 : channel_(channel), |
| 198 voe_network_(voe_network), | 198 voe_network_(voe_network), |
| 199 parser_(RtpHeaderParser::Create()) {} | 199 parser_(RtpHeaderParser::Create()) {} |
| 200 DeliveryStatus DeliverPacket(MediaType media_type, const uint8_t* packet, | 200 DeliveryStatus DeliverPacket(MediaType media_type, |
| 201 size_t length) override { | 201 const uint8_t* packet, |
| 202 size_t length, |
| 203 const PacketTime& packet_time) override { |
| 202 EXPECT_TRUE(media_type == MediaType::ANY || | 204 EXPECT_TRUE(media_type == MediaType::ANY || |
| 203 media_type == MediaType::AUDIO); | 205 media_type == MediaType::AUDIO); |
| 204 int ret; | 206 int ret; |
| 205 if (parser_->IsRtcp(packet, length)) { | 207 if (parser_->IsRtcp(packet, length)) { |
| 206 ret = voe_network_->ReceivedRTCPPacket(channel_, packet, length); | 208 ret = voe_network_->ReceivedRTCPPacket(channel_, packet, length); |
| 207 } else { | 209 } else { |
| 208 ret = voe_network_->ReceivedRTPPacket(channel_, packet, length, | 210 ret = voe_network_->ReceivedRTPPacket(channel_, packet, length, |
| 209 PacketTime()); | 211 PacketTime()); |
| 210 } | 212 } |
| 211 return ret == 0 ? DELIVERY_OK : DELIVERY_PACKET_ERROR; | 213 return ret == 0 ? DELIVERY_OK : DELIVERY_PACKET_ERROR; |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 pad_to_min_bitrate_(using_min_transmit_bitrate), | 540 pad_to_min_bitrate_(using_min_transmit_bitrate), |
| 539 num_bitrate_observations_in_range_(0) {} | 541 num_bitrate_observations_in_range_(0) {} |
| 540 | 542 |
| 541 private: | 543 private: |
| 542 void SetReceivers(PacketReceiver* send_transport_receiver, | 544 void SetReceivers(PacketReceiver* send_transport_receiver, |
| 543 PacketReceiver* receive_transport_receiver) override { | 545 PacketReceiver* receive_transport_receiver) override { |
| 544 send_transport_receiver_ = send_transport_receiver; | 546 send_transport_receiver_ = send_transport_receiver; |
| 545 test::RtpRtcpObserver::SetReceivers(this, receive_transport_receiver); | 547 test::RtpRtcpObserver::SetReceivers(this, receive_transport_receiver); |
| 546 } | 548 } |
| 547 | 549 |
| 548 DeliveryStatus DeliverPacket(MediaType media_type, const uint8_t* packet, | 550 DeliveryStatus DeliverPacket(MediaType media_type, |
| 549 size_t length) override { | 551 const uint8_t* packet, |
| 552 size_t length, |
| 553 const PacketTime& packet_time) override { |
| 550 VideoSendStream::Stats stats = send_stream_->GetStats(); | 554 VideoSendStream::Stats stats = send_stream_->GetStats(); |
| 551 if (stats.substreams.size() > 0) { | 555 if (stats.substreams.size() > 0) { |
| 552 DCHECK_EQ(1u, stats.substreams.size()); | 556 DCHECK_EQ(1u, stats.substreams.size()); |
| 553 int bitrate_kbps = | 557 int bitrate_kbps = |
| 554 stats.substreams.begin()->second.total_bitrate_bps / 1000; | 558 stats.substreams.begin()->second.total_bitrate_bps / 1000; |
| 555 if (bitrate_kbps > 0) { | 559 if (bitrate_kbps > 0) { |
| 556 test::PrintResult( | 560 test::PrintResult( |
| 557 "bitrate_stats_", | 561 "bitrate_stats_", |
| 558 (pad_to_min_bitrate_ ? "min_transmit_bitrate" | 562 (pad_to_min_bitrate_ ? "min_transmit_bitrate" |
| 559 : "without_min_transmit_bitrate"), | 563 : "without_min_transmit_bitrate"), |
| (...skipping 13 matching lines...) Expand all Loading... |
| 573 bitrate_kbps < (kMaxEncodeBitrateKbps + | 577 bitrate_kbps < (kMaxEncodeBitrateKbps + |
| 574 kAcceptableBitrateErrorMargin / 2)) { | 578 kAcceptableBitrateErrorMargin / 2)) { |
| 575 ++num_bitrate_observations_in_range_; | 579 ++num_bitrate_observations_in_range_; |
| 576 } | 580 } |
| 577 } | 581 } |
| 578 if (num_bitrate_observations_in_range_ == | 582 if (num_bitrate_observations_in_range_ == |
| 579 kNumBitrateObservationsInRange) | 583 kNumBitrateObservationsInRange) |
| 580 observation_complete_->Set(); | 584 observation_complete_->Set(); |
| 581 } | 585 } |
| 582 } | 586 } |
| 583 return send_transport_receiver_->DeliverPacket(media_type, packet, | 587 return send_transport_receiver_->DeliverPacket(media_type, packet, length, |
| 584 length); | 588 packet_time); |
| 585 } | 589 } |
| 586 | 590 |
| 587 void OnStreamsCreated( | 591 void OnStreamsCreated( |
| 588 VideoSendStream* send_stream, | 592 VideoSendStream* send_stream, |
| 589 const std::vector<VideoReceiveStream*>& receive_streams) override { | 593 const std::vector<VideoReceiveStream*>& receive_streams) override { |
| 590 send_stream_ = send_stream; | 594 send_stream_ = send_stream; |
| 591 } | 595 } |
| 592 | 596 |
| 593 void ModifyConfigs(VideoSendStream::Config* send_config, | 597 void ModifyConfigs(VideoSendStream::Config* send_config, |
| 594 std::vector<VideoReceiveStream::Config>* receive_configs, | 598 std::vector<VideoReceiveStream::Config>* receive_configs, |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 int encoder_inits_; | 708 int encoder_inits_; |
| 705 uint32_t last_set_bitrate_; | 709 uint32_t last_set_bitrate_; |
| 706 VideoSendStream* send_stream_; | 710 VideoSendStream* send_stream_; |
| 707 VideoEncoderConfig encoder_config_; | 711 VideoEncoderConfig encoder_config_; |
| 708 } test; | 712 } test; |
| 709 | 713 |
| 710 RunBaseTest(&test); | 714 RunBaseTest(&test); |
| 711 } | 715 } |
| 712 | 716 |
| 713 } // namespace webrtc | 717 } // namespace webrtc |
| OLD | NEW |