Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Side by Side Diff: webrtc/call/call.cc

Issue 1470373004: Rewrote pacer and bandwidth UMA stats. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Comments addressed - again. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 VoiceEngine* voice_engine() { 108 VoiceEngine* voice_engine() {
109 internal::AudioState* audio_state = 109 internal::AudioState* audio_state =
110 static_cast<internal::AudioState*>(config_.audio_state.get()); 110 static_cast<internal::AudioState*>(config_.audio_state.get());
111 if (audio_state) 111 if (audio_state)
112 return audio_state->voice_engine(); 112 return audio_state->voice_engine();
113 else 113 else
114 return nullptr; 114 return nullptr;
115 } 115 }
116 116
117 void UpdateSendHistograms(); 117 void UpdateSendHistograms() EXCLUSIVE_LOCKS_REQUIRED(&bitrate_crit_);
118 void UpdateReceiveHistograms(); 118 void UpdateReceiveHistograms();
119 119
120 const Clock* const clock_; 120 const Clock* const clock_;
121 121
122 const int num_cpu_cores_; 122 const int num_cpu_cores_;
123 const rtc::scoped_ptr<ProcessThread> module_process_thread_; 123 const rtc::scoped_ptr<ProcessThread> module_process_thread_;
124 const rtc::scoped_ptr<CallStats> call_stats_; 124 const rtc::scoped_ptr<CallStats> call_stats_;
125 const rtc::scoped_ptr<BitrateAllocator> bitrate_allocator_; 125 const rtc::scoped_ptr<BitrateAllocator> bitrate_allocator_;
126 Call::Config config_; 126 Call::Config config_;
127 rtc::ThreadChecker configuration_thread_checker_; 127 rtc::ThreadChecker configuration_thread_checker_;
(...skipping 17 matching lines...) Expand all
145 std::map<uint32_t, VideoSendStream*> video_send_ssrcs_ GUARDED_BY(send_crit_); 145 std::map<uint32_t, VideoSendStream*> video_send_ssrcs_ GUARDED_BY(send_crit_);
146 std::set<VideoSendStream*> video_send_streams_ GUARDED_BY(send_crit_); 146 std::set<VideoSendStream*> video_send_streams_ GUARDED_BY(send_crit_);
147 147
148 VideoSendStream::RtpStateMap suspended_video_send_ssrcs_; 148 VideoSendStream::RtpStateMap suspended_video_send_ssrcs_;
149 149
150 RtcEventLog* event_log_ = nullptr; 150 RtcEventLog* event_log_ = nullptr;
151 151
152 // The following members are only accessed (exclusively) from one thread and 152 // The following members are only accessed (exclusively) from one thread and
153 // from the destructor, and therefore doesn't need any explicit 153 // from the destructor, and therefore doesn't need any explicit
154 // synchronization. 154 // synchronization.
155 rtc::RateTracker received_video_bytes_per_sec_; 155 int64_t received_video_bytes_;
156 rtc::RateTracker received_audio_bytes_per_sec_; 156 int64_t received_audio_bytes_;
157 rtc::RateTracker received_rtcp_bytes_per_sec_; 157 int64_t received_rtcp_bytes_;
158 int64_t first_rtp_packet_received_ms_;
159 int64_t last_rtp_packet_received_ms_;
158 int64_t first_packet_sent_ms_; 160 int64_t first_packet_sent_ms_;
159 int64_t first_rtp_packet_received_ms_;
160 161
161 // TODO(holmer): Remove this lock once BitrateController no longer calls 162 // TODO(holmer): Remove this lock once BitrateController no longer calls
162 // OnNetworkChanged from multiple threads. 163 // OnNetworkChanged from multiple threads.
163 rtc::CriticalSection bitrate_crit_; 164 rtc::CriticalSection bitrate_crit_;
164 rtc::RateTracker estimated_send_bitrate_kbps_ GUARDED_BY(&bitrate_crit_); 165 int64_t estimated_send_bitrate_sum_kbits_ GUARDED_BY(&bitrate_crit_);
165 rtc::RateTracker pacer_bitrate_kbps_ GUARDED_BY(&bitrate_crit_); 166 int64_t pacer_bitrate_sum_kbits_ GUARDED_BY(&bitrate_crit_);
166 uint32_t target_bitrate_bps_ GUARDED_BY(&bitrate_crit_); 167 int64_t num_bitrate_updates_ GUARDED_BY(&bitrate_crit_);
167 uint32_t pacer_bitrate_bps_ GUARDED_BY(&bitrate_crit_);
168 int64_t last_bitrate_update_ms_ GUARDED_BY(&bitrate_crit_);
169 168
170 const rtc::scoped_ptr<CongestionController> congestion_controller_; 169 const rtc::scoped_ptr<CongestionController> congestion_controller_;
171 170
172 RTC_DISALLOW_COPY_AND_ASSIGN(Call); 171 RTC_DISALLOW_COPY_AND_ASSIGN(Call);
173 }; 172 };
174 } // namespace internal 173 } // namespace internal
175 174
176 Call* Call::Create(const Call::Config& config) { 175 Call* Call::Create(const Call::Config& config) {
177 return new internal::Call(config); 176 return new internal::Call(config);
178 } 177 }
179 178
180 namespace internal { 179 namespace internal {
181 180
182 Call::Call(const Call::Config& config) 181 Call::Call(const Call::Config& config)
183 : clock_(Clock::GetRealTimeClock()), 182 : clock_(Clock::GetRealTimeClock()),
184 num_cpu_cores_(CpuInfo::DetectNumberOfCores()), 183 num_cpu_cores_(CpuInfo::DetectNumberOfCores()),
185 module_process_thread_(ProcessThread::Create("ModuleProcessThread")), 184 module_process_thread_(ProcessThread::Create("ModuleProcessThread")),
186 call_stats_(new CallStats()), 185 call_stats_(new CallStats()),
187 bitrate_allocator_(new BitrateAllocator()), 186 bitrate_allocator_(new BitrateAllocator()),
188 config_(config), 187 config_(config),
189 network_enabled_(true), 188 network_enabled_(true),
190 receive_crit_(RWLockWrapper::CreateRWLock()), 189 receive_crit_(RWLockWrapper::CreateRWLock()),
191 send_crit_(RWLockWrapper::CreateRWLock()), 190 send_crit_(RWLockWrapper::CreateRWLock()),
192 received_video_bytes_per_sec_(1000, 1), 191 received_video_bytes_(0),
193 received_audio_bytes_per_sec_(1000, 1), 192 received_audio_bytes_(0),
194 received_rtcp_bytes_per_sec_(1000, 1), 193 received_rtcp_bytes_(0),
194 first_rtp_packet_received_ms_(-1),
195 last_rtp_packet_received_ms_(-1),
195 first_packet_sent_ms_(-1), 196 first_packet_sent_ms_(-1),
196 first_rtp_packet_received_ms_(-1), 197 estimated_send_bitrate_sum_kbits_(0),
197 estimated_send_bitrate_kbps_(1000, 1), 198 pacer_bitrate_sum_kbits_(0),
198 pacer_bitrate_kbps_(1000, 1), 199 num_bitrate_updates_(0),
199 target_bitrate_bps_(0),
200 pacer_bitrate_bps_(0),
201 last_bitrate_update_ms_(-1),
202 congestion_controller_( 200 congestion_controller_(
203 new CongestionController(module_process_thread_.get(), 201 new CongestionController(module_process_thread_.get(),
204 call_stats_.get(), 202 call_stats_.get(),
205 this)) { 203 this)) {
206 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 204 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
207 RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0); 205 RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0);
208 RTC_DCHECK_GE(config.bitrate_config.start_bitrate_bps, 206 RTC_DCHECK_GE(config.bitrate_config.start_bitrate_bps,
209 config.bitrate_config.min_bitrate_bps); 207 config.bitrate_config.min_bitrate_bps);
210 if (config.bitrate_config.max_bitrate_bps != -1) { 208 if (config.bitrate_config.max_bitrate_bps != -1) {
211 RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps, 209 RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps,
(...skipping 26 matching lines...) Expand all
238 RTC_CHECK(audio_receive_ssrcs_.empty()); 236 RTC_CHECK(audio_receive_ssrcs_.empty());
239 RTC_CHECK(video_receive_ssrcs_.empty()); 237 RTC_CHECK(video_receive_ssrcs_.empty());
240 RTC_CHECK(video_receive_streams_.empty()); 238 RTC_CHECK(video_receive_streams_.empty());
241 239
242 module_process_thread_->DeRegisterModule(call_stats_.get()); 240 module_process_thread_->DeRegisterModule(call_stats_.get());
243 module_process_thread_->Stop(); 241 module_process_thread_->Stop();
244 Trace::ReturnTrace(); 242 Trace::ReturnTrace();
245 } 243 }
246 244
247 void Call::UpdateSendHistograms() { 245 void Call::UpdateSendHistograms() {
248 if (first_packet_sent_ms_ == -1) 246 if (num_bitrate_updates_ == 0 || first_packet_sent_ms_ == -1)
249 return; 247 return;
250 int64_t elapsed_sec = 248 int64_t elapsed_sec =
251 (clock_->TimeInMilliseconds() - first_packet_sent_ms_) / 1000; 249 (clock_->TimeInMilliseconds() - first_packet_sent_ms_) / 1000;
252 if (elapsed_sec < metrics::kMinRunTimeInSeconds) 250 if (elapsed_sec < metrics::kMinRunTimeInSeconds)
253 return; 251 return;
254 rtc::CritScope lock(&bitrate_crit_); 252 int send_bitrate_kbps =
255 int send_bitrate_kbps = estimated_send_bitrate_kbps_.ComputeTotalRate(); 253 estimated_send_bitrate_sum_kbits_ / num_bitrate_updates_;
256 int pacer_bitrate_kbps = pacer_bitrate_kbps_.ComputeTotalRate(); 254 int pacer_bitrate_kbps = pacer_bitrate_sum_kbits_ / num_bitrate_updates_;
257 if (send_bitrate_kbps > 0) { 255 if (send_bitrate_kbps > 0) {
258 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.EstimatedSendBitrateInKbps", 256 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.EstimatedSendBitrateInKbps",
259 send_bitrate_kbps); 257 send_bitrate_kbps);
260 } 258 }
261 if (pacer_bitrate_kbps > 0) { 259 if (pacer_bitrate_kbps > 0) {
262 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.PacerBitrateInKbps", 260 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.PacerBitrateInKbps",
263 pacer_bitrate_kbps); 261 pacer_bitrate_kbps);
264 } 262 }
265 } 263 }
266 264
267 void Call::UpdateReceiveHistograms() { 265 void Call::UpdateReceiveHistograms() {
268 if (first_rtp_packet_received_ms_ == -1) 266 if (first_rtp_packet_received_ms_ == -1)
269 return; 267 return;
270 int64_t elapsed_sec = 268 int64_t elapsed_sec =
271 (clock_->TimeInMilliseconds() - first_rtp_packet_received_ms_) / 1000; 269 (last_rtp_packet_received_ms_ - first_rtp_packet_received_ms_) / 1000;
272 if (elapsed_sec < metrics::kMinRunTimeInSeconds) 270 if (elapsed_sec < metrics::kMinRunTimeInSeconds)
273 return; 271 return;
274 int audio_bitrate_kbps = 272 int audio_bitrate_kbps = received_audio_bytes_ * 8 / elapsed_sec / 1000;
275 received_audio_bytes_per_sec_.ComputeTotalRate() * 8 / 1000; 273 int video_bitrate_kbps = received_video_bytes_ * 8 / elapsed_sec / 1000;
276 int video_bitrate_kbps = 274 int rtcp_bitrate_bps = received_rtcp_bytes_ * 8 / elapsed_sec;
277 received_video_bytes_per_sec_.ComputeTotalRate() * 8 / 1000;
278 int rtcp_bitrate_bps = received_rtcp_bytes_per_sec_.ComputeTotalRate() * 8;
279 if (video_bitrate_kbps > 0) { 275 if (video_bitrate_kbps > 0) {
280 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.VideoBitrateReceivedInKbps", 276 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.VideoBitrateReceivedInKbps",
281 video_bitrate_kbps); 277 video_bitrate_kbps);
282 } 278 }
283 if (audio_bitrate_kbps > 0) { 279 if (audio_bitrate_kbps > 0) {
284 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.AudioBitrateReceivedInKbps", 280 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.AudioBitrateReceivedInKbps",
285 audio_bitrate_kbps); 281 audio_bitrate_kbps);
286 } 282 }
287 if (rtcp_bitrate_bps > 0) { 283 if (rtcp_bitrate_bps > 0) {
288 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.RtcpBitrateReceivedInBps", 284 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.RtcpBitrateReceivedInBps",
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 } 565 }
570 566
571 void Call::OnSentPacket(const rtc::SentPacket& sent_packet) { 567 void Call::OnSentPacket(const rtc::SentPacket& sent_packet) {
572 if (first_packet_sent_ms_ == -1) 568 if (first_packet_sent_ms_ == -1)
573 first_packet_sent_ms_ = clock_->TimeInMilliseconds(); 569 first_packet_sent_ms_ = clock_->TimeInMilliseconds();
574 congestion_controller_->OnSentPacket(sent_packet); 570 congestion_controller_->OnSentPacket(sent_packet);
575 } 571 }
576 572
577 void Call::OnNetworkChanged(uint32_t target_bitrate_bps, uint8_t fraction_loss, 573 void Call::OnNetworkChanged(uint32_t target_bitrate_bps, uint8_t fraction_loss,
578 int64_t rtt_ms) { 574 int64_t rtt_ms) {
579 int64_t now_ms = clock_->TimeInMilliseconds();
580 int64_t time_since_last_update_ms = 0;
581 {
582 rtc::CritScope lock(&bitrate_crit_);
583 if (last_bitrate_update_ms_ >= 0)
584 time_since_last_update_ms = now_ms - last_bitrate_update_ms_;
585 estimated_send_bitrate_kbps_.AddSamples(
586 time_since_last_update_ms * (target_bitrate_bps_ / 1000) / 1000);
587 pacer_bitrate_kbps_.AddSamples(time_since_last_update_ms *
588 (pacer_bitrate_bps_ / 1000) / 1000);
589 target_bitrate_bps_ = target_bitrate_bps;
590 last_bitrate_update_ms_ = now_ms;
591 }
592 uint32_t allocated_bitrate_bps = bitrate_allocator_->OnNetworkChanged( 575 uint32_t allocated_bitrate_bps = bitrate_allocator_->OnNetworkChanged(
593 target_bitrate_bps, fraction_loss, rtt_ms); 576 target_bitrate_bps, fraction_loss, rtt_ms);
594 577
595 int pad_up_to_bitrate_bps = 0; 578 int pad_up_to_bitrate_bps = 0;
596 { 579 {
597 ReadLockScoped read_lock(*send_crit_); 580 ReadLockScoped read_lock(*send_crit_);
598 // No need to update as long as we're not sending. 581 // No need to update as long as we're not sending.
599 if (video_send_streams_.empty()) 582 if (video_send_streams_.empty())
600 return; 583 return;
601 584
602 for (VideoSendStream* stream : video_send_streams_) 585 for (VideoSendStream* stream : video_send_streams_)
603 pad_up_to_bitrate_bps += stream->GetPaddingNeededBps(); 586 pad_up_to_bitrate_bps += stream->GetPaddingNeededBps();
604 } 587 }
605 // Allocated bitrate might be higher than bitrate estimate if enforcing min 588 // Allocated bitrate might be higher than bitrate estimate if enforcing min
606 // bitrate, or lower if estimate is higher than the sum of max bitrates, so 589 // bitrate, or lower if estimate is higher than the sum of max bitrates, so
607 // set the pacer bitrate to the maximum of the two. 590 // set the pacer bitrate to the maximum of the two.
608 uint32_t pacer_bitrate_bps = 591 uint32_t pacer_bitrate_bps =
609 std::max(target_bitrate_bps, allocated_bitrate_bps); 592 std::max(target_bitrate_bps, allocated_bitrate_bps);
610 { 593 {
611 rtc::CritScope lock(&bitrate_crit_); 594 rtc::CritScope lock(&bitrate_crit_);
612 pacer_bitrate_bps_ = pacer_bitrate_bps; 595 // We only update these stats if we have send streams, and assume that
596 // OnNetworkChanged is called roughly with a fixed frequency.
597 estimated_send_bitrate_sum_kbits_ += target_bitrate_bps / 1000;
598 pacer_bitrate_sum_kbits_ += pacer_bitrate_bps / 1000;
599 ++num_bitrate_updates_;
613 } 600 }
614 congestion_controller_->UpdatePacerBitrate( 601 congestion_controller_->UpdatePacerBitrate(
615 target_bitrate_bps / 1000, 602 target_bitrate_bps / 1000,
616 PacedSender::kDefaultPaceMultiplier * pacer_bitrate_bps / 1000, 603 PacedSender::kDefaultPaceMultiplier * pacer_bitrate_bps / 1000,
617 pad_up_to_bitrate_bps / 1000); 604 pad_up_to_bitrate_bps / 1000);
618 } 605 }
619 606
620 void Call::ConfigureSync(const std::string& sync_group) { 607 void Call::ConfigureSync(const std::string& sync_group) {
621 // Set sync only if there was no previous one. 608 // Set sync only if there was no previous one.
622 if (voice_engine() == nullptr || sync_group.empty()) 609 if (voice_engine() == nullptr || sync_group.empty())
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 } 652 }
666 } 653 }
667 654
668 PacketReceiver::DeliveryStatus Call::DeliverRtcp(MediaType media_type, 655 PacketReceiver::DeliveryStatus Call::DeliverRtcp(MediaType media_type,
669 const uint8_t* packet, 656 const uint8_t* packet,
670 size_t length) { 657 size_t length) {
671 // TODO(pbos): Figure out what channel needs it actually. 658 // TODO(pbos): Figure out what channel needs it actually.
672 // Do NOT broadcast! Also make sure it's a valid packet. 659 // Do NOT broadcast! Also make sure it's a valid packet.
673 // Return DELIVERY_UNKNOWN_SSRC if it can be determined that 660 // Return DELIVERY_UNKNOWN_SSRC if it can be determined that
674 // there's no receiver of the packet. 661 // there's no receiver of the packet.
675 received_rtcp_bytes_per_sec_.AddSamples(length); 662 received_rtcp_bytes_ += length;
676 bool rtcp_delivered = false; 663 bool rtcp_delivered = false;
677 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) { 664 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) {
678 ReadLockScoped read_lock(*receive_crit_); 665 ReadLockScoped read_lock(*receive_crit_);
679 for (VideoReceiveStream* stream : video_receive_streams_) { 666 for (VideoReceiveStream* stream : video_receive_streams_) {
680 if (stream->DeliverRtcp(packet, length)) { 667 if (stream->DeliverRtcp(packet, length)) {
681 rtcp_delivered = true; 668 rtcp_delivered = true;
682 if (event_log_) 669 if (event_log_)
683 event_log_->LogRtcpPacket(true, media_type, packet, length); 670 event_log_->LogRtcpPacket(true, media_type, packet, length);
684 } 671 }
685 } 672 }
(...skipping 12 matching lines...) Expand all
698 } 685 }
699 686
700 PacketReceiver::DeliveryStatus Call::DeliverRtp(MediaType media_type, 687 PacketReceiver::DeliveryStatus Call::DeliverRtp(MediaType media_type,
701 const uint8_t* packet, 688 const uint8_t* packet,
702 size_t length, 689 size_t length,
703 const PacketTime& packet_time) { 690 const PacketTime& packet_time) {
704 // Minimum RTP header size. 691 // Minimum RTP header size.
705 if (length < 12) 692 if (length < 12)
706 return DELIVERY_PACKET_ERROR; 693 return DELIVERY_PACKET_ERROR;
707 694
695 last_rtp_packet_received_ms_ = clock_->TimeInMilliseconds();
708 if (first_rtp_packet_received_ms_ == -1) 696 if (first_rtp_packet_received_ms_ == -1)
709 first_rtp_packet_received_ms_ = clock_->TimeInMilliseconds(); 697 first_rtp_packet_received_ms_ = last_rtp_packet_received_ms_;
710 698
711 uint32_t ssrc = ByteReader<uint32_t>::ReadBigEndian(&packet[8]); 699 uint32_t ssrc = ByteReader<uint32_t>::ReadBigEndian(&packet[8]);
712 ReadLockScoped read_lock(*receive_crit_); 700 ReadLockScoped read_lock(*receive_crit_);
713 if (media_type == MediaType::ANY || media_type == MediaType::AUDIO) { 701 if (media_type == MediaType::ANY || media_type == MediaType::AUDIO) {
714 auto it = audio_receive_ssrcs_.find(ssrc); 702 auto it = audio_receive_ssrcs_.find(ssrc);
715 if (it != audio_receive_ssrcs_.end()) { 703 if (it != audio_receive_ssrcs_.end()) {
716 received_audio_bytes_per_sec_.AddSamples(length); 704 received_audio_bytes_ += length;
717 auto status = it->second->DeliverRtp(packet, length, packet_time) 705 auto status = it->second->DeliverRtp(packet, length, packet_time)
718 ? DELIVERY_OK 706 ? DELIVERY_OK
719 : DELIVERY_PACKET_ERROR; 707 : DELIVERY_PACKET_ERROR;
720 if (status == DELIVERY_OK && event_log_) 708 if (status == DELIVERY_OK && event_log_)
721 event_log_->LogRtpHeader(true, media_type, packet, length); 709 event_log_->LogRtpHeader(true, media_type, packet, length);
722 return status; 710 return status;
723 } 711 }
724 } 712 }
725 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) { 713 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) {
726 auto it = video_receive_ssrcs_.find(ssrc); 714 auto it = video_receive_ssrcs_.find(ssrc);
727 if (it != video_receive_ssrcs_.end()) { 715 if (it != video_receive_ssrcs_.end()) {
728 received_video_bytes_per_sec_.AddSamples(length); 716 received_video_bytes_ += length;
729 auto status = it->second->DeliverRtp(packet, length, packet_time) 717 auto status = it->second->DeliverRtp(packet, length, packet_time)
730 ? DELIVERY_OK 718 ? DELIVERY_OK
731 : DELIVERY_PACKET_ERROR; 719 : DELIVERY_PACKET_ERROR;
732 if (status == DELIVERY_OK && event_log_) 720 if (status == DELIVERY_OK && event_log_)
733 event_log_->LogRtpHeader(true, media_type, packet, length); 721 event_log_->LogRtpHeader(true, media_type, packet, length);
734 return status; 722 return status;
735 } 723 }
736 } 724 }
737 return DELIVERY_UNKNOWN_SSRC; 725 return DELIVERY_UNKNOWN_SSRC;
738 } 726 }
739 727
740 PacketReceiver::DeliveryStatus Call::DeliverPacket( 728 PacketReceiver::DeliveryStatus Call::DeliverPacket(
741 MediaType media_type, 729 MediaType media_type,
742 const uint8_t* packet, 730 const uint8_t* packet,
743 size_t length, 731 size_t length,
744 const PacketTime& packet_time) { 732 const PacketTime& packet_time) {
745 // TODO(solenberg): Tests call this function on a network thread, libjingle 733 // TODO(solenberg): Tests call this function on a network thread, libjingle
746 // calls on the worker thread. We should move towards always using a network 734 // calls on the worker thread. We should move towards always using a network
747 // thread. Then this check can be enabled. 735 // thread. Then this check can be enabled.
748 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); 736 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread());
749 if (RtpHeaderParser::IsRtcp(packet, length)) 737 if (RtpHeaderParser::IsRtcp(packet, length))
750 return DeliverRtcp(media_type, packet, length); 738 return DeliverRtcp(media_type, packet, length);
751 739
752 return DeliverRtp(media_type, packet, length, packet_time); 740 return DeliverRtp(media_type, packet, length, packet_time);
753 } 741 }
754 742
755 } // namespace internal 743 } // namespace internal
756 } // namespace webrtc 744 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698