Chromium Code Reviews| 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 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 #include "webrtc/call/bitrate_allocator.h" | 31 #include "webrtc/call/bitrate_allocator.h" |
| 32 #include "webrtc/call/flexfec_receive_stream.h" | 32 #include "webrtc/call/flexfec_receive_stream.h" |
| 33 #include "webrtc/config.h" | 33 #include "webrtc/config.h" |
| 34 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 34 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
| 35 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" | 35 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" |
| 36 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" | 36 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" |
| 37 #include "webrtc/modules/pacing/paced_sender.h" | 37 #include "webrtc/modules/pacing/paced_sender.h" |
| 38 #include "webrtc/modules/rtp_rtcp/include/flexfec_receiver.h" | 38 #include "webrtc/modules/rtp_rtcp/include/flexfec_receiver.h" |
| 39 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" | 39 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" |
| 40 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 40 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
| 41 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" | |
| 42 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h" | |
| 43 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h" | |
| 41 #include "webrtc/modules/utility/include/process_thread.h" | 44 #include "webrtc/modules/utility/include/process_thread.h" |
| 42 #include "webrtc/system_wrappers/include/clock.h" | 45 #include "webrtc/system_wrappers/include/clock.h" |
| 43 #include "webrtc/system_wrappers/include/cpu_info.h" | 46 #include "webrtc/system_wrappers/include/cpu_info.h" |
| 44 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 47 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
| 45 #include "webrtc/system_wrappers/include/metrics.h" | 48 #include "webrtc/system_wrappers/include/metrics.h" |
| 46 #include "webrtc/system_wrappers/include/rw_lock_wrapper.h" | 49 #include "webrtc/system_wrappers/include/rw_lock_wrapper.h" |
| 47 #include "webrtc/system_wrappers/include/trace.h" | 50 #include "webrtc/system_wrappers/include/trace.h" |
| 48 #include "webrtc/video/call_stats.h" | 51 #include "webrtc/video/call_stats.h" |
| 49 #include "webrtc/video/send_delay_stats.h" | 52 #include "webrtc/video/send_delay_stats.h" |
| 50 #include "webrtc/video/stats_counter.h" | 53 #include "webrtc/video/stats_counter.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 | 149 |
| 147 VoiceEngine* voice_engine() { | 150 VoiceEngine* voice_engine() { |
| 148 internal::AudioState* audio_state = | 151 internal::AudioState* audio_state = |
| 149 static_cast<internal::AudioState*>(config_.audio_state.get()); | 152 static_cast<internal::AudioState*>(config_.audio_state.get()); |
| 150 if (audio_state) | 153 if (audio_state) |
| 151 return audio_state->voice_engine(); | 154 return audio_state->voice_engine(); |
| 152 else | 155 else |
| 153 return nullptr; | 156 return nullptr; |
| 154 } | 157 } |
| 155 | 158 |
| 159 RtpPacketReceived ParseRtpPacket( | |
| 160 const uint8_t* packet, | |
| 161 size_t length, | |
| 162 const PacketTime& packet_time, | |
| 163 const RtpHeaderExtensionMap* rtp_header_extensions); | |
| 164 | |
| 156 void UpdateSendHistograms() EXCLUSIVE_LOCKS_REQUIRED(&bitrate_crit_); | 165 void UpdateSendHistograms() EXCLUSIVE_LOCKS_REQUIRED(&bitrate_crit_); |
| 157 void UpdateReceiveHistograms(); | 166 void UpdateReceiveHistograms(); |
| 158 void UpdateHistograms(); | 167 void UpdateHistograms(); |
| 159 void UpdateAggregateNetworkState(); | 168 void UpdateAggregateNetworkState(); |
| 160 | 169 |
| 161 Clock* const clock_; | 170 Clock* const clock_; |
| 162 | 171 |
| 163 const int num_cpu_cores_; | 172 const int num_cpu_cores_; |
| 164 const std::unique_ptr<ProcessThread> module_process_thread_; | 173 const std::unique_ptr<ProcessThread> module_process_thread_; |
| 165 const std::unique_ptr<ProcessThread> pacer_thread_; | 174 const std::unique_ptr<ProcessThread> pacer_thread_; |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 184 // streams. | 193 // streams. |
| 185 std::multimap<uint32_t, FlexfecReceiveStream*> flexfec_receive_ssrcs_media_ | 194 std::multimap<uint32_t, FlexfecReceiveStream*> flexfec_receive_ssrcs_media_ |
| 186 GUARDED_BY(receive_crit_); | 195 GUARDED_BY(receive_crit_); |
| 187 std::map<uint32_t, FlexfecReceiveStream*> flexfec_receive_ssrcs_protection_ | 196 std::map<uint32_t, FlexfecReceiveStream*> flexfec_receive_ssrcs_protection_ |
| 188 GUARDED_BY(receive_crit_); | 197 GUARDED_BY(receive_crit_); |
| 189 std::set<FlexfecReceiveStream*> flexfec_receive_streams_ | 198 std::set<FlexfecReceiveStream*> flexfec_receive_streams_ |
| 190 GUARDED_BY(receive_crit_); | 199 GUARDED_BY(receive_crit_); |
| 191 std::map<std::string, AudioReceiveStream*> sync_stream_mapping_ | 200 std::map<std::string, AudioReceiveStream*> sync_stream_mapping_ |
| 192 GUARDED_BY(receive_crit_); | 201 GUARDED_BY(receive_crit_); |
| 193 | 202 |
| 203 // Registered RTP header extensions for each stream. | |
| 204 // Note that RTP header extensions are negotiated per track ("m= line") in the | |
| 205 // SDP, but we have no notion of tracks at the Call level. We therefore store | |
| 206 // the RTP header extensions per SSRC instead, which may lead to some | |
| 207 // overhead. | |
| 208 std::map<uint32_t, RtpHeaderExtensionMap> received_rtp_header_extensions_ | |
| 209 GUARDED_BY(receive_crit_); | |
| 210 | |
| 194 std::unique_ptr<RWLockWrapper> send_crit_; | 211 std::unique_ptr<RWLockWrapper> send_crit_; |
| 195 // Audio and Video send streams are owned by the client that creates them. | 212 // Audio and Video send streams are owned by the client that creates them. |
| 196 std::map<uint32_t, AudioSendStream*> audio_send_ssrcs_ GUARDED_BY(send_crit_); | 213 std::map<uint32_t, AudioSendStream*> audio_send_ssrcs_ GUARDED_BY(send_crit_); |
| 197 std::map<uint32_t, VideoSendStream*> video_send_ssrcs_ GUARDED_BY(send_crit_); | 214 std::map<uint32_t, VideoSendStream*> video_send_ssrcs_ GUARDED_BY(send_crit_); |
| 198 std::set<VideoSendStream*> video_send_streams_ GUARDED_BY(send_crit_); | 215 std::set<VideoSendStream*> video_send_streams_ GUARDED_BY(send_crit_); |
| 199 | 216 |
| 200 VideoSendStream::RtpStateMap suspended_video_send_ssrcs_; | 217 VideoSendStream::RtpStateMap suspended_video_send_ssrcs_; |
| 201 webrtc::RtcEventLog* event_log_; | 218 webrtc::RtcEventLog* event_log_; |
| 202 | 219 |
| 203 // The following members are only accessed (exclusively) from one thread and | 220 // The following members are only accessed (exclusively) from one thread and |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 245 ss << "pacer_delay_ms: " << pacer_delay_ms << ", "; | 262 ss << "pacer_delay_ms: " << pacer_delay_ms << ", "; |
| 246 ss << "rtt_ms: " << rtt_ms; | 263 ss << "rtt_ms: " << rtt_ms; |
| 247 ss << '}'; | 264 ss << '}'; |
| 248 return ss.str(); | 265 return ss.str(); |
| 249 } | 266 } |
| 250 | 267 |
| 251 Call* Call::Create(const Call::Config& config) { | 268 Call* Call::Create(const Call::Config& config) { |
| 252 return new internal::Call(config); | 269 return new internal::Call(config); |
| 253 } | 270 } |
| 254 | 271 |
| 272 namespace { | |
| 273 | |
| 274 RtpHeaderExtensionMap CreateRtpHeaderExtensionMap( | |
|
danilchap
2016/12/06 15:04:30
this function implemented as a constructor of the
brandtr
2016/12/12 13:51:07
Great!
| |
| 275 const std::vector<RtpExtension>& rtp_header_extensions) { | |
| 276 RtpHeaderExtensionMap map; | |
| 277 for (const auto& extension : rtp_header_extensions) { | |
| 278 if (extension.uri == AbsoluteSendTime::kUri) { | |
| 279 map.Register<AbsoluteSendTime>(extension.id); | |
| 280 } else if (extension.uri == AudioLevel::kUri) { | |
| 281 map.Register<AudioLevel>(extension.id); | |
| 282 } else if (extension.uri == TransmissionOffset::kUri) { | |
| 283 map.Register<TransmissionOffset>(extension.id); | |
| 284 } else if (extension.uri == TransportSequenceNumber::kUri) { | |
| 285 map.Register<TransportSequenceNumber>(extension.id); | |
| 286 } else if (extension.uri == VideoOrientation::kUri) { | |
| 287 map.Register<VideoOrientation>(extension.id); | |
| 288 } else if (extension.uri == PlayoutDelayLimits::kUri) { | |
| 289 map.Register<PlayoutDelayLimits>(extension.id); | |
| 290 } | |
| 291 } | |
| 292 return map; | |
| 293 } | |
| 294 | |
| 295 } // namespace | |
| 296 | |
| 255 namespace internal { | 297 namespace internal { |
| 256 | 298 |
| 257 Call::Call(const Call::Config& config) | 299 Call::Call(const Call::Config& config) |
| 258 : clock_(Clock::GetRealTimeClock()), | 300 : clock_(Clock::GetRealTimeClock()), |
| 259 num_cpu_cores_(CpuInfo::DetectNumberOfCores()), | 301 num_cpu_cores_(CpuInfo::DetectNumberOfCores()), |
| 260 module_process_thread_(ProcessThread::Create("ModuleProcessThread")), | 302 module_process_thread_(ProcessThread::Create("ModuleProcessThread")), |
| 261 pacer_thread_(ProcessThread::Create("PacerThread")), | 303 pacer_thread_(ProcessThread::Create("PacerThread")), |
| 262 call_stats_(new CallStats(clock_)), | 304 call_stats_(new CallStats(clock_)), |
| 263 bitrate_allocator_(new BitrateAllocator(this)), | 305 bitrate_allocator_(new BitrateAllocator(this)), |
| 264 config_(config), | 306 config_(config), |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 337 { | 379 { |
| 338 rtc::CritScope lock(&bitrate_crit_); | 380 rtc::CritScope lock(&bitrate_crit_); |
| 339 UpdateSendHistograms(); | 381 UpdateSendHistograms(); |
| 340 } | 382 } |
| 341 UpdateReceiveHistograms(); | 383 UpdateReceiveHistograms(); |
| 342 UpdateHistograms(); | 384 UpdateHistograms(); |
| 343 | 385 |
| 344 Trace::ReturnTrace(); | 386 Trace::ReturnTrace(); |
| 345 } | 387 } |
| 346 | 388 |
| 389 RtpPacketReceived Call::ParseRtpPacket( | |
| 390 const uint8_t* packet, | |
| 391 size_t length, | |
| 392 const PacketTime& packet_time, | |
| 393 const RtpHeaderExtensionMap* rtp_header_extensions) { | |
| 394 RtpPacketReceived parsed_packet(nullptr); | |
| 395 parsed_packet.Parse(packet, length); | |
|
danilchap
2016/12/06 15:04:30
what if Parse fails?
brandtr
2016/12/12 13:51:07
Fixed by using optional.
| |
| 396 int64_t arrival_time_ms; | |
| 397 if (packet_time.timestamp != -1) { | |
| 398 arrival_time_ms = (packet_time.timestamp + 500) / 1000; | |
| 399 } else { | |
| 400 arrival_time_ms = clock_->TimeInMilliseconds(); | |
| 401 } | |
| 402 parsed_packet.set_arrival_time_ms(arrival_time_ms); | |
| 403 return parsed_packet; | |
| 404 } | |
| 405 | |
| 347 void Call::UpdateHistograms() { | 406 void Call::UpdateHistograms() { |
| 348 RTC_HISTOGRAM_COUNTS_100000( | 407 RTC_HISTOGRAM_COUNTS_100000( |
| 349 "WebRTC.Call.LifetimeInSeconds", | 408 "WebRTC.Call.LifetimeInSeconds", |
| 350 (clock_->TimeInMilliseconds() - start_ms_) / 1000); | 409 (clock_->TimeInMilliseconds() - start_ms_) / 1000); |
| 351 } | 410 } |
| 352 | 411 |
| 353 void Call::UpdateSendHistograms() { | 412 void Call::UpdateSendHistograms() { |
| 354 if (first_packet_sent_ms_ == -1) | 413 if (first_packet_sent_ms_ == -1) |
| 355 return; | 414 return; |
| 356 int64_t elapsed_sec = | 415 int64_t elapsed_sec = |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 474 delete audio_send_stream; | 533 delete audio_send_stream; |
| 475 } | 534 } |
| 476 | 535 |
| 477 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( | 536 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( |
| 478 const webrtc::AudioReceiveStream::Config& config) { | 537 const webrtc::AudioReceiveStream::Config& config) { |
| 479 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); | 538 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); |
| 480 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 539 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
| 481 event_log_->LogAudioReceiveStreamConfig(config); | 540 event_log_->LogAudioReceiveStreamConfig(config); |
| 482 AudioReceiveStream* receive_stream = new AudioReceiveStream( | 541 AudioReceiveStream* receive_stream = new AudioReceiveStream( |
| 483 &packet_router_, | 542 &packet_router_, |
| 484 // TODO(nisse): Used only when UseSendSideBwe(config) is true. | 543 congestion_controller_->GetRemoteBitrateEstimator( |
| 485 congestion_controller_->GetRemoteBitrateEstimator(true), config, | 544 CongestionController::UseSendSideBwe( |
| 486 config_.audio_state, event_log_); | 545 config.rtp.transport_cc, |
| 546 CreateRtpHeaderExtensionMap(config.rtp.extensions))), | |
| 547 config, config_.audio_state, event_log_); | |
| 487 { | 548 { |
| 488 WriteLockScoped write_lock(*receive_crit_); | 549 WriteLockScoped write_lock(*receive_crit_); |
| 489 RTC_DCHECK(audio_receive_ssrcs_.find(config.rtp.remote_ssrc) == | 550 RTC_DCHECK(audio_receive_ssrcs_.find(config.rtp.remote_ssrc) == |
| 490 audio_receive_ssrcs_.end()); | 551 audio_receive_ssrcs_.end()); |
| 491 audio_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream; | 552 audio_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream; |
| 492 ConfigureSync(config.sync_group); | 553 ConfigureSync(config.sync_group); |
| 493 } | 554 } |
| 494 { | 555 { |
| 495 ReadLockScoped read_lock(*send_crit_); | 556 ReadLockScoped read_lock(*send_crit_); |
| 496 auto it = audio_send_ssrcs_.find(config.rtp.local_ssrc); | 557 auto it = audio_send_ssrcs_.find(config.rtp.local_ssrc); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 651 ConfigureSync(receive_stream_impl->config().sync_group); | 712 ConfigureSync(receive_stream_impl->config().sync_group); |
| 652 } | 713 } |
| 653 UpdateAggregateNetworkState(); | 714 UpdateAggregateNetworkState(); |
| 654 delete receive_stream_impl; | 715 delete receive_stream_impl; |
| 655 } | 716 } |
| 656 | 717 |
| 657 webrtc::FlexfecReceiveStream* Call::CreateFlexfecReceiveStream( | 718 webrtc::FlexfecReceiveStream* Call::CreateFlexfecReceiveStream( |
| 658 const webrtc::FlexfecReceiveStream::Config& config) { | 719 const webrtc::FlexfecReceiveStream::Config& config) { |
| 659 TRACE_EVENT0("webrtc", "Call::CreateFlexfecReceiveStream"); | 720 TRACE_EVENT0("webrtc", "Call::CreateFlexfecReceiveStream"); |
| 660 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 721 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
| 661 FlexfecReceiveStream* receive_stream = new FlexfecReceiveStream(config, this); | 722 |
| 723 RtpHeaderExtensionMap rtp_header_extensions = | |
| 724 CreateRtpHeaderExtensionMap(config.rtp_header_extensions); | |
| 725 RecoveredPacketReceiver* recovered_packet_receiver = this; | |
| 726 RemoteBitrateEstimator* remote_bitrate_estimator = | |
| 727 congestion_controller_->GetRemoteBitrateEstimator( | |
| 728 CongestionController::UseSendSideBwe(config.transport_cc, | |
| 729 rtp_header_extensions)); | |
| 730 FlexfecReceiveStream* receive_stream = new FlexfecReceiveStream( | |
| 731 config, recovered_packet_receiver, remote_bitrate_estimator); | |
| 662 | 732 |
| 663 { | 733 { |
| 664 WriteLockScoped write_lock(*receive_crit_); | 734 WriteLockScoped write_lock(*receive_crit_); |
| 735 | |
| 736 RTC_DCHECK(flexfec_receive_streams_.find(receive_stream) == | |
| 737 flexfec_receive_streams_.end()); | |
| 738 flexfec_receive_streams_.insert(receive_stream); | |
| 739 | |
| 665 for (auto ssrc : config.protected_media_ssrcs) | 740 for (auto ssrc : config.protected_media_ssrcs) |
| 666 flexfec_receive_ssrcs_media_.insert(std::make_pair(ssrc, receive_stream)); | 741 flexfec_receive_ssrcs_media_.insert(std::make_pair(ssrc, receive_stream)); |
| 742 | |
| 667 RTC_DCHECK(flexfec_receive_ssrcs_protection_.find(config.remote_ssrc) == | 743 RTC_DCHECK(flexfec_receive_ssrcs_protection_.find(config.remote_ssrc) == |
| 668 flexfec_receive_ssrcs_protection_.end()); | 744 flexfec_receive_ssrcs_protection_.end()); |
| 669 flexfec_receive_ssrcs_protection_[config.remote_ssrc] = receive_stream; | 745 flexfec_receive_ssrcs_protection_[config.remote_ssrc] = receive_stream; |
| 670 flexfec_receive_streams_.insert(receive_stream); | 746 |
| 747 RTC_DCHECK(received_rtp_header_extensions_.find(config.remote_ssrc) == | |
| 748 received_rtp_header_extensions_.end()); | |
| 749 received_rtp_header_extensions_[config.remote_ssrc] = | |
| 750 std::move(rtp_header_extensions); | |
|
danilchap
2016/12/06 15:04:30
do not move:
RtpHeaderExtensionMap doesn't have a
brandtr
2016/12/12 13:51:07
Done.
| |
| 671 } | 751 } |
| 752 | |
| 672 // TODO(brandtr): Store config in RtcEventLog here. | 753 // TODO(brandtr): Store config in RtcEventLog here. |
| 754 | |
| 673 return receive_stream; | 755 return receive_stream; |
| 674 } | 756 } |
| 675 | 757 |
| 676 void Call::DestroyFlexfecReceiveStream( | 758 void Call::DestroyFlexfecReceiveStream( |
| 677 webrtc::FlexfecReceiveStream* receive_stream) { | 759 webrtc::FlexfecReceiveStream* receive_stream) { |
| 678 TRACE_EVENT0("webrtc", "Call::DestroyFlexfecReceiveStream"); | 760 TRACE_EVENT0("webrtc", "Call::DestroyFlexfecReceiveStream"); |
| 679 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 761 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
| 762 | |
| 680 RTC_DCHECK(receive_stream != nullptr); | 763 RTC_DCHECK(receive_stream != nullptr); |
| 764 | |
| 681 // There exist no other derived classes of webrtc::FlexfecReceiveStream, | 765 // There exist no other derived classes of webrtc::FlexfecReceiveStream, |
| 682 // so this downcast is safe. | 766 // so this downcast is safe. |
| 683 FlexfecReceiveStream* receive_stream_impl = | 767 FlexfecReceiveStream* receive_stream_impl = |
| 684 static_cast<FlexfecReceiveStream*>(receive_stream); | 768 static_cast<FlexfecReceiveStream*>(receive_stream); |
| 769 uint32_t ssrc = receive_stream_impl->config().remote_ssrc; | |
| 770 | |
| 685 { | 771 { |
| 686 WriteLockScoped write_lock(*receive_crit_); | 772 WriteLockScoped write_lock(*receive_crit_); |
| 687 // Remove all SSRCs pointing to the FlexfecReceiveStream to be destroyed. | 773 |
| 688 auto media_it = flexfec_receive_ssrcs_media_.begin(); | 774 received_rtp_header_extensions_.erase(ssrc); |
| 689 while (media_it != flexfec_receive_ssrcs_media_.end()) { | 775 |
| 690 if (media_it->second == receive_stream_impl) | |
| 691 media_it = flexfec_receive_ssrcs_media_.erase(media_it); | |
| 692 else | |
| 693 ++media_it; | |
| 694 } | |
| 695 auto prot_it = flexfec_receive_ssrcs_protection_.begin(); | 776 auto prot_it = flexfec_receive_ssrcs_protection_.begin(); |
| 696 while (prot_it != flexfec_receive_ssrcs_protection_.end()) { | 777 while (prot_it != flexfec_receive_ssrcs_protection_.end()) { |
| 697 if (prot_it->second == receive_stream_impl) | 778 if (prot_it->second == receive_stream_impl) |
| 698 prot_it = flexfec_receive_ssrcs_protection_.erase(prot_it); | 779 prot_it = flexfec_receive_ssrcs_protection_.erase(prot_it); |
| 699 else | 780 else |
| 700 ++prot_it; | 781 ++prot_it; |
| 701 } | 782 } |
| 783 | |
| 784 auto media_it = flexfec_receive_ssrcs_media_.begin(); | |
| 785 while (media_it != flexfec_receive_ssrcs_media_.end()) { | |
| 786 if (media_it->second == receive_stream_impl) | |
| 787 media_it = flexfec_receive_ssrcs_media_.erase(media_it); | |
| 788 else | |
| 789 ++media_it; | |
| 790 } | |
| 791 | |
| 702 flexfec_receive_streams_.erase(receive_stream_impl); | 792 flexfec_receive_streams_.erase(receive_stream_impl); |
| 703 } | 793 } |
| 794 | |
| 704 delete receive_stream_impl; | 795 delete receive_stream_impl; |
| 705 } | 796 } |
| 706 | 797 |
| 707 Call::Stats Call::GetStats() const { | 798 Call::Stats Call::GetStats() const { |
| 708 // TODO(solenberg): Some test cases in EndToEndTest use this from a different | 799 // TODO(solenberg): Some test cases in EndToEndTest use this from a different |
| 709 // thread. Re-enable once that is fixed. | 800 // thread. Re-enable once that is fixed. |
| 710 // RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 801 // RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
| 711 Stats stats; | 802 Stats stats; |
| 712 // Fetch available send/receive bitrates. | 803 // Fetch available send/receive bitrates. |
| 713 uint32_t send_bandwidth = 0; | 804 uint32_t send_bandwidth = 0; |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1070 } | 1161 } |
| 1071 } | 1162 } |
| 1072 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) { | 1163 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) { |
| 1073 auto it = video_receive_ssrcs_.find(ssrc); | 1164 auto it = video_receive_ssrcs_.find(ssrc); |
| 1074 if (it != video_receive_ssrcs_.end()) { | 1165 if (it != video_receive_ssrcs_.end()) { |
| 1075 received_bytes_per_second_counter_.Add(static_cast<int>(length)); | 1166 received_bytes_per_second_counter_.Add(static_cast<int>(length)); |
| 1076 received_video_bytes_per_second_counter_.Add(static_cast<int>(length)); | 1167 received_video_bytes_per_second_counter_.Add(static_cast<int>(length)); |
| 1077 auto status = it->second->DeliverRtp(packet, length, packet_time) | 1168 auto status = it->second->DeliverRtp(packet, length, packet_time) |
| 1078 ? DELIVERY_OK | 1169 ? DELIVERY_OK |
| 1079 : DELIVERY_PACKET_ERROR; | 1170 : DELIVERY_PACKET_ERROR; |
| 1080 // Deliver media packets to FlexFEC subsystem. | 1171 // Deliver media packets to FlexFEC subsystem. RTP header extensions need |
| 1172 // not be parsed, as FlexFEC is oblivious to the semantic meaning of the | |
|
danilchap
2016/12/06 15:04:30
what about BWE header extensions?
brandtr
2016/12/12 13:51:07
Extended comment to why this is not relevant for m
| |
| 1173 // payload. | |
| 1174 RtpPacketReceived parsed_packet = | |
| 1175 ParseRtpPacket(packet, length, packet_time, nullptr); | |
| 1081 auto it_bounds = flexfec_receive_ssrcs_media_.equal_range(ssrc); | 1176 auto it_bounds = flexfec_receive_ssrcs_media_.equal_range(ssrc); |
| 1082 for (auto it = it_bounds.first; it != it_bounds.second; ++it) | 1177 for (auto it = it_bounds.first; it != it_bounds.second; ++it) |
| 1083 it->second->AddAndProcessReceivedPacket(packet, length); | 1178 it->second->AddAndProcessReceivedPacket(parsed_packet); |
| 1084 if (status == DELIVERY_OK) | 1179 if (status == DELIVERY_OK) |
| 1085 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length); | 1180 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length); |
| 1086 return status; | 1181 return status; |
| 1087 } | 1182 } |
| 1088 } | 1183 } |
| 1089 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) { | 1184 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) { |
| 1090 auto it = flexfec_receive_ssrcs_protection_.find(ssrc); | 1185 auto it = flexfec_receive_ssrcs_protection_.find(ssrc); |
| 1091 if (it != flexfec_receive_ssrcs_protection_.end()) { | 1186 if (it != flexfec_receive_ssrcs_protection_.end()) { |
| 1092 auto status = it->second->AddAndProcessReceivedPacket(packet, length) | 1187 const RtpHeaderExtensionMap& extensions = |
| 1093 ? DELIVERY_OK | 1188 received_rtp_header_extensions_[ssrc]; |
| 1094 : DELIVERY_PACKET_ERROR; | 1189 RtpPacketReceived parsed_packet = |
| 1190 ParseRtpPacket(packet, length, packet_time, &extensions); | |
| 1191 auto status = | |
| 1192 it->second->AddAndProcessReceivedPacket(std::move(parsed_packet)) | |
| 1193 ? DELIVERY_OK | |
| 1194 : DELIVERY_PACKET_ERROR; | |
| 1095 if (status == DELIVERY_OK) | 1195 if (status == DELIVERY_OK) |
| 1096 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length); | 1196 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length); |
| 1097 return status; | 1197 return status; |
| 1098 } | 1198 } |
| 1099 } | 1199 } |
| 1100 return DELIVERY_UNKNOWN_SSRC; | 1200 return DELIVERY_UNKNOWN_SSRC; |
| 1101 } | 1201 } |
| 1102 | 1202 |
| 1103 PacketReceiver::DeliveryStatus Call::DeliverPacket( | 1203 PacketReceiver::DeliveryStatus Call::DeliverPacket( |
| 1104 MediaType media_type, | 1204 MediaType media_type, |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 1121 uint32_t ssrc = ByteReader<uint32_t>::ReadBigEndian(&packet[8]); | 1221 uint32_t ssrc = ByteReader<uint32_t>::ReadBigEndian(&packet[8]); |
| 1122 ReadLockScoped read_lock(*receive_crit_); | 1222 ReadLockScoped read_lock(*receive_crit_); |
| 1123 auto it = video_receive_ssrcs_.find(ssrc); | 1223 auto it = video_receive_ssrcs_.find(ssrc); |
| 1124 if (it == video_receive_ssrcs_.end()) | 1224 if (it == video_receive_ssrcs_.end()) |
| 1125 return false; | 1225 return false; |
| 1126 return it->second->OnRecoveredPacket(packet, length); | 1226 return it->second->OnRecoveredPacket(packet, length); |
| 1127 } | 1227 } |
| 1128 | 1228 |
| 1129 } // namespace internal | 1229 } // namespace internal |
| 1130 } // namespace webrtc | 1230 } // namespace webrtc |
| OLD | NEW |