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 |
| 11 #include <string.h> | 11 #include <string.h> |
| 12 #include <algorithm> | 12 #include <algorithm> |
| 13 #include <map> | 13 #include <map> |
| 14 #include <memory> | 14 #include <memory> |
| 15 #include <set> | 15 #include <set> |
| 16 #include <utility> | 16 #include <utility> |
| 17 #include <vector> | 17 #include <vector> |
| 18 | 18 |
| 19 #include "webrtc/audio/audio_receive_stream.h" | 19 #include "webrtc/audio/audio_receive_stream.h" |
| 20 #include "webrtc/audio/audio_send_stream.h" | 20 #include "webrtc/audio/audio_send_stream.h" |
| 21 #include "webrtc/audio/audio_state.h" | 21 #include "webrtc/audio/audio_state.h" |
| 22 #include "webrtc/audio/scoped_voe_interface.h" | 22 #include "webrtc/audio/scoped_voe_interface.h" |
| 23 #include "webrtc/base/basictypes.h" | 23 #include "webrtc/base/basictypes.h" |
| 24 #include "webrtc/base/checks.h" | 24 #include "webrtc/base/checks.h" |
| 25 #include "webrtc/base/constructormagic.h" | 25 #include "webrtc/base/constructormagic.h" |
| 26 #include "webrtc/base/logging.h" | 26 #include "webrtc/base/logging.h" |
| 27 #include "webrtc/base/optional.h" | |
| 27 #include "webrtc/base/task_queue.h" | 28 #include "webrtc/base/task_queue.h" |
| 28 #include "webrtc/base/thread_annotations.h" | 29 #include "webrtc/base/thread_annotations.h" |
| 29 #include "webrtc/base/thread_checker.h" | 30 #include "webrtc/base/thread_checker.h" |
| 30 #include "webrtc/base/trace_event.h" | 31 #include "webrtc/base/trace_event.h" |
| 31 #include "webrtc/call/bitrate_allocator.h" | 32 #include "webrtc/call/bitrate_allocator.h" |
| 32 #include "webrtc/call/call.h" | 33 #include "webrtc/call/call.h" |
| 33 #include "webrtc/call/flexfec_receive_stream.h" | 34 #include "webrtc/call/flexfec_receive_stream.h" |
| 34 #include "webrtc/config.h" | 35 #include "webrtc/config.h" |
| 35 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 36 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
| 36 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" | 37 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" |
| 37 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" | 38 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" |
| 38 #include "webrtc/modules/pacing/paced_sender.h" | 39 #include "webrtc/modules/pacing/paced_sender.h" |
| 39 #include "webrtc/modules/rtp_rtcp/include/flexfec_receiver.h" | 40 #include "webrtc/modules/rtp_rtcp/include/flexfec_receiver.h" |
| 40 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" | 41 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" |
| 41 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 42 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
| 43 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" | |
| 44 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h" | |
| 42 #include "webrtc/modules/utility/include/process_thread.h" | 45 #include "webrtc/modules/utility/include/process_thread.h" |
| 43 #include "webrtc/system_wrappers/include/clock.h" | 46 #include "webrtc/system_wrappers/include/clock.h" |
| 44 #include "webrtc/system_wrappers/include/cpu_info.h" | 47 #include "webrtc/system_wrappers/include/cpu_info.h" |
| 45 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 48 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
| 46 #include "webrtc/system_wrappers/include/metrics.h" | 49 #include "webrtc/system_wrappers/include/metrics.h" |
| 47 #include "webrtc/system_wrappers/include/rw_lock_wrapper.h" | 50 #include "webrtc/system_wrappers/include/rw_lock_wrapper.h" |
| 48 #include "webrtc/system_wrappers/include/trace.h" | 51 #include "webrtc/system_wrappers/include/trace.h" |
| 49 #include "webrtc/video/call_stats.h" | 52 #include "webrtc/video/call_stats.h" |
| 50 #include "webrtc/video/send_delay_stats.h" | 53 #include "webrtc/video/send_delay_stats.h" |
| 51 #include "webrtc/video/stats_counter.h" | 54 #include "webrtc/video/stats_counter.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 | 150 |
| 148 VoiceEngine* voice_engine() { | 151 VoiceEngine* voice_engine() { |
| 149 internal::AudioState* audio_state = | 152 internal::AudioState* audio_state = |
| 150 static_cast<internal::AudioState*>(config_.audio_state.get()); | 153 static_cast<internal::AudioState*>(config_.audio_state.get()); |
| 151 if (audio_state) | 154 if (audio_state) |
| 152 return audio_state->voice_engine(); | 155 return audio_state->voice_engine(); |
| 153 else | 156 else |
| 154 return nullptr; | 157 return nullptr; |
| 155 } | 158 } |
| 156 | 159 |
| 160 rtc::Optional<RtpPacketReceived> ParseRtpPacket( | |
| 161 const uint8_t* packet, | |
| 162 size_t length, | |
| 163 const PacketTime& packet_time, | |
| 164 const RtpHeaderExtensionMap* rtp_header_extensions); | |
| 165 | |
| 157 void UpdateSendHistograms() EXCLUSIVE_LOCKS_REQUIRED(&bitrate_crit_); | 166 void UpdateSendHistograms() EXCLUSIVE_LOCKS_REQUIRED(&bitrate_crit_); |
| 158 void UpdateReceiveHistograms(); | 167 void UpdateReceiveHistograms(); |
| 159 void UpdateHistograms(); | 168 void UpdateHistograms(); |
| 160 void UpdateAggregateNetworkState(); | 169 void UpdateAggregateNetworkState(); |
| 161 | 170 |
| 162 Clock* const clock_; | 171 Clock* const clock_; |
| 163 | 172 |
| 164 const int num_cpu_cores_; | 173 const int num_cpu_cores_; |
| 165 const std::unique_ptr<ProcessThread> module_process_thread_; | 174 const std::unique_ptr<ProcessThread> module_process_thread_; |
| 166 const std::unique_ptr<ProcessThread> pacer_thread_; | 175 const std::unique_ptr<ProcessThread> pacer_thread_; |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 185 // streams. | 194 // streams. |
| 186 std::multimap<uint32_t, FlexfecReceiveStream*> flexfec_receive_ssrcs_media_ | 195 std::multimap<uint32_t, FlexfecReceiveStream*> flexfec_receive_ssrcs_media_ |
| 187 GUARDED_BY(receive_crit_); | 196 GUARDED_BY(receive_crit_); |
| 188 std::map<uint32_t, FlexfecReceiveStream*> flexfec_receive_ssrcs_protection_ | 197 std::map<uint32_t, FlexfecReceiveStream*> flexfec_receive_ssrcs_protection_ |
| 189 GUARDED_BY(receive_crit_); | 198 GUARDED_BY(receive_crit_); |
| 190 std::set<FlexfecReceiveStream*> flexfec_receive_streams_ | 199 std::set<FlexfecReceiveStream*> flexfec_receive_streams_ |
| 191 GUARDED_BY(receive_crit_); | 200 GUARDED_BY(receive_crit_); |
| 192 std::map<std::string, AudioReceiveStream*> sync_stream_mapping_ | 201 std::map<std::string, AudioReceiveStream*> sync_stream_mapping_ |
| 193 GUARDED_BY(receive_crit_); | 202 GUARDED_BY(receive_crit_); |
| 194 | 203 |
| 204 // Registered RTP header extensions for each stream. | |
| 205 // Note that RTP header extensions are negotiated per track ("m= line") in the | |
| 206 // SDP, but we have no notion of tracks at the Call level. We therefore store | |
| 207 // the RTP header extensions per SSRC instead, which leads to some storage | |
| 208 // overhead. | |
| 209 std::map<uint32_t, RtpHeaderExtensionMap> received_rtp_header_extensions_ | |
| 210 GUARDED_BY(receive_crit_); | |
| 211 | |
| 195 std::unique_ptr<RWLockWrapper> send_crit_; | 212 std::unique_ptr<RWLockWrapper> send_crit_; |
| 196 // Audio and Video send streams are owned by the client that creates them. | 213 // Audio and Video send streams are owned by the client that creates them. |
| 197 std::map<uint32_t, AudioSendStream*> audio_send_ssrcs_ GUARDED_BY(send_crit_); | 214 std::map<uint32_t, AudioSendStream*> audio_send_ssrcs_ GUARDED_BY(send_crit_); |
| 198 std::map<uint32_t, VideoSendStream*> video_send_ssrcs_ GUARDED_BY(send_crit_); | 215 std::map<uint32_t, VideoSendStream*> video_send_ssrcs_ GUARDED_BY(send_crit_); |
| 199 std::set<VideoSendStream*> video_send_streams_ GUARDED_BY(send_crit_); | 216 std::set<VideoSendStream*> video_send_streams_ GUARDED_BY(send_crit_); |
| 200 | 217 |
| 201 VideoSendStream::RtpStateMap suspended_video_send_ssrcs_; | 218 VideoSendStream::RtpStateMap suspended_video_send_ssrcs_; |
| 202 webrtc::RtcEventLog* event_log_; | 219 webrtc::RtcEventLog* event_log_; |
| 203 | 220 |
| 204 // The following members are only accessed (exclusively) from one thread and | 221 // The following members are only accessed (exclusively) from one thread and |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 338 { | 355 { |
| 339 rtc::CritScope lock(&bitrate_crit_); | 356 rtc::CritScope lock(&bitrate_crit_); |
| 340 UpdateSendHistograms(); | 357 UpdateSendHistograms(); |
| 341 } | 358 } |
| 342 UpdateReceiveHistograms(); | 359 UpdateReceiveHistograms(); |
| 343 UpdateHistograms(); | 360 UpdateHistograms(); |
| 344 | 361 |
| 345 Trace::ReturnTrace(); | 362 Trace::ReturnTrace(); |
| 346 } | 363 } |
| 347 | 364 |
| 365 rtc::Optional<RtpPacketReceived> Call::ParseRtpPacket( | |
| 366 const uint8_t* packet, | |
| 367 size_t length, | |
| 368 const PacketTime& packet_time, | |
| 369 const RtpHeaderExtensionMap* rtp_header_extensions) { | |
| 370 RtpPacketReceived parsed_packet(rtp_header_extensions); | |
| 371 if (!parsed_packet.Parse(packet, length)) | |
| 372 return rtc::Optional<RtpPacketReceived>(); | |
| 373 | |
| 374 int64_t arrival_time_ms; | |
| 375 if (packet_time.timestamp != -1) { | |
| 376 arrival_time_ms = (packet_time.timestamp + 500) / 1000; | |
| 377 } else { | |
| 378 arrival_time_ms = clock_->TimeInMilliseconds(); | |
|
philipel
2016/12/13 13:58:27
It looks like Call::DeliverRtp takes a PacketTime
brandtr
2016/12/14 12:55:49
Line 376 :)
| |
| 379 } | |
| 380 parsed_packet.set_arrival_time_ms(arrival_time_ms); | |
| 381 | |
| 382 return rtc::Optional<RtpPacketReceived>(parsed_packet); | |
| 383 } | |
| 384 | |
| 348 void Call::UpdateHistograms() { | 385 void Call::UpdateHistograms() { |
| 349 RTC_HISTOGRAM_COUNTS_100000( | 386 RTC_HISTOGRAM_COUNTS_100000( |
| 350 "WebRTC.Call.LifetimeInSeconds", | 387 "WebRTC.Call.LifetimeInSeconds", |
| 351 (clock_->TimeInMilliseconds() - start_ms_) / 1000); | 388 (clock_->TimeInMilliseconds() - start_ms_) / 1000); |
| 352 } | 389 } |
| 353 | 390 |
| 354 void Call::UpdateSendHistograms() { | 391 void Call::UpdateSendHistograms() { |
| 355 if (first_packet_sent_ms_ == -1) | 392 if (first_packet_sent_ms_ == -1) |
| 356 return; | 393 return; |
| 357 int64_t elapsed_sec = | 394 int64_t elapsed_sec = |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 652 ConfigureSync(receive_stream_impl->config().sync_group); | 689 ConfigureSync(receive_stream_impl->config().sync_group); |
| 653 } | 690 } |
| 654 UpdateAggregateNetworkState(); | 691 UpdateAggregateNetworkState(); |
| 655 delete receive_stream_impl; | 692 delete receive_stream_impl; |
| 656 } | 693 } |
| 657 | 694 |
| 658 webrtc::FlexfecReceiveStream* Call::CreateFlexfecReceiveStream( | 695 webrtc::FlexfecReceiveStream* Call::CreateFlexfecReceiveStream( |
| 659 const webrtc::FlexfecReceiveStream::Config& config) { | 696 const webrtc::FlexfecReceiveStream::Config& config) { |
| 660 TRACE_EVENT0("webrtc", "Call::CreateFlexfecReceiveStream"); | 697 TRACE_EVENT0("webrtc", "Call::CreateFlexfecReceiveStream"); |
| 661 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 698 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
| 662 FlexfecReceiveStream* receive_stream = new FlexfecReceiveStream(config, this); | 699 |
| 700 RtpHeaderExtensionMap rtp_header_extensions(config.rtp_header_extensions); | |
| 701 RecoveredPacketReceiver* recovered_packet_receiver = this; | |
| 702 RemoteBitrateEstimator* remote_bitrate_estimator = | |
| 703 congestion_controller_->GetRemoteBitrateEstimator( | |
| 704 CongestionController::UseSendSideBwe(config.transport_cc, | |
| 705 rtp_header_extensions)); | |
| 706 FlexfecReceiveStream* receive_stream = new FlexfecReceiveStream( | |
| 707 config, recovered_packet_receiver, remote_bitrate_estimator); | |
|
philipel
2016/12/13 13:58:27
As we concluded in our offline discussion, the Fle
brandtr
2016/12/14 12:55:49
Yes, it makes more sense to put this in internal::
| |
| 663 | 708 |
| 664 { | 709 { |
| 665 WriteLockScoped write_lock(*receive_crit_); | 710 WriteLockScoped write_lock(*receive_crit_); |
| 711 | |
| 712 RTC_DCHECK(flexfec_receive_streams_.find(receive_stream) == | |
| 713 flexfec_receive_streams_.end()); | |
| 714 flexfec_receive_streams_.insert(receive_stream); | |
| 715 | |
| 666 for (auto ssrc : config.protected_media_ssrcs) | 716 for (auto ssrc : config.protected_media_ssrcs) |
| 667 flexfec_receive_ssrcs_media_.insert(std::make_pair(ssrc, receive_stream)); | 717 flexfec_receive_ssrcs_media_.insert(std::make_pair(ssrc, receive_stream)); |
| 718 | |
| 668 RTC_DCHECK(flexfec_receive_ssrcs_protection_.find(config.remote_ssrc) == | 719 RTC_DCHECK(flexfec_receive_ssrcs_protection_.find(config.remote_ssrc) == |
| 669 flexfec_receive_ssrcs_protection_.end()); | 720 flexfec_receive_ssrcs_protection_.end()); |
| 670 flexfec_receive_ssrcs_protection_[config.remote_ssrc] = receive_stream; | 721 flexfec_receive_ssrcs_protection_[config.remote_ssrc] = receive_stream; |
| 671 flexfec_receive_streams_.insert(receive_stream); | 722 |
| 723 RTC_DCHECK(received_rtp_header_extensions_.find(config.remote_ssrc) == | |
| 724 received_rtp_header_extensions_.end()); | |
| 725 received_rtp_header_extensions_[config.remote_ssrc] = rtp_header_extensions; | |
| 672 } | 726 } |
| 727 | |
| 673 // TODO(brandtr): Store config in RtcEventLog here. | 728 // TODO(brandtr): Store config in RtcEventLog here. |
| 729 | |
| 674 return receive_stream; | 730 return receive_stream; |
| 675 } | 731 } |
| 676 | 732 |
| 677 void Call::DestroyFlexfecReceiveStream( | 733 void Call::DestroyFlexfecReceiveStream( |
| 678 webrtc::FlexfecReceiveStream* receive_stream) { | 734 webrtc::FlexfecReceiveStream* receive_stream) { |
| 679 TRACE_EVENT0("webrtc", "Call::DestroyFlexfecReceiveStream"); | 735 TRACE_EVENT0("webrtc", "Call::DestroyFlexfecReceiveStream"); |
| 680 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 736 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
| 737 | |
| 681 RTC_DCHECK(receive_stream != nullptr); | 738 RTC_DCHECK(receive_stream != nullptr); |
| 739 | |
| 682 // There exist no other derived classes of webrtc::FlexfecReceiveStream, | 740 // There exist no other derived classes of webrtc::FlexfecReceiveStream, |
| 683 // so this downcast is safe. | 741 // so this downcast is safe. |
| 684 FlexfecReceiveStream* receive_stream_impl = | 742 FlexfecReceiveStream* receive_stream_impl = |
| 685 static_cast<FlexfecReceiveStream*>(receive_stream); | 743 static_cast<FlexfecReceiveStream*>(receive_stream); |
| 744 uint32_t ssrc = receive_stream_impl->GetConfig().remote_ssrc; | |
| 745 | |
| 686 { | 746 { |
| 687 WriteLockScoped write_lock(*receive_crit_); | 747 WriteLockScoped write_lock(*receive_crit_); |
| 748 | |
| 749 received_rtp_header_extensions_.erase(ssrc); | |
| 750 | |
| 688 // Remove all SSRCs pointing to the FlexfecReceiveStream to be destroyed. | 751 // Remove all SSRCs pointing to the FlexfecReceiveStream to be destroyed. |
| 689 auto media_it = flexfec_receive_ssrcs_media_.begin(); | |
| 690 while (media_it != flexfec_receive_ssrcs_media_.end()) { | |
| 691 if (media_it->second == receive_stream_impl) | |
| 692 media_it = flexfec_receive_ssrcs_media_.erase(media_it); | |
| 693 else | |
| 694 ++media_it; | |
| 695 } | |
| 696 auto prot_it = flexfec_receive_ssrcs_protection_.begin(); | 752 auto prot_it = flexfec_receive_ssrcs_protection_.begin(); |
| 697 while (prot_it != flexfec_receive_ssrcs_protection_.end()) { | 753 while (prot_it != flexfec_receive_ssrcs_protection_.end()) { |
| 698 if (prot_it->second == receive_stream_impl) | 754 if (prot_it->second == receive_stream_impl) |
| 699 prot_it = flexfec_receive_ssrcs_protection_.erase(prot_it); | 755 prot_it = flexfec_receive_ssrcs_protection_.erase(prot_it); |
| 700 else | 756 else |
| 701 ++prot_it; | 757 ++prot_it; |
| 702 } | 758 } |
| 759 auto media_it = flexfec_receive_ssrcs_media_.begin(); | |
| 760 while (media_it != flexfec_receive_ssrcs_media_.end()) { | |
| 761 if (media_it->second == receive_stream_impl) | |
| 762 media_it = flexfec_receive_ssrcs_media_.erase(media_it); | |
| 763 else | |
| 764 ++media_it; | |
| 765 } | |
| 766 | |
| 703 flexfec_receive_streams_.erase(receive_stream_impl); | 767 flexfec_receive_streams_.erase(receive_stream_impl); |
| 704 } | 768 } |
| 769 | |
| 705 delete receive_stream_impl; | 770 delete receive_stream_impl; |
| 706 } | 771 } |
| 707 | 772 |
| 708 Call::Stats Call::GetStats() const { | 773 Call::Stats Call::GetStats() const { |
| 709 // TODO(solenberg): Some test cases in EndToEndTest use this from a different | 774 // TODO(solenberg): Some test cases in EndToEndTest use this from a different |
| 710 // thread. Re-enable once that is fixed. | 775 // thread. Re-enable once that is fixed. |
| 711 // RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 776 // RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
| 712 Stats stats; | 777 Stats stats; |
| 713 // Fetch available send/receive bitrates. | 778 // Fetch available send/receive bitrates. |
| 714 uint32_t send_bandwidth = 0; | 779 uint32_t send_bandwidth = 0; |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1071 } | 1136 } |
| 1072 } | 1137 } |
| 1073 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) { | 1138 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) { |
| 1074 auto it = video_receive_ssrcs_.find(ssrc); | 1139 auto it = video_receive_ssrcs_.find(ssrc); |
| 1075 if (it != video_receive_ssrcs_.end()) { | 1140 if (it != video_receive_ssrcs_.end()) { |
| 1076 received_bytes_per_second_counter_.Add(static_cast<int>(length)); | 1141 received_bytes_per_second_counter_.Add(static_cast<int>(length)); |
| 1077 received_video_bytes_per_second_counter_.Add(static_cast<int>(length)); | 1142 received_video_bytes_per_second_counter_.Add(static_cast<int>(length)); |
| 1078 auto status = it->second->DeliverRtp(packet, length, packet_time) | 1143 auto status = it->second->DeliverRtp(packet, length, packet_time) |
| 1079 ? DELIVERY_OK | 1144 ? DELIVERY_OK |
| 1080 : DELIVERY_PACKET_ERROR; | 1145 : DELIVERY_PACKET_ERROR; |
| 1081 // Deliver media packets to FlexFEC subsystem. | 1146 // Deliver media packets to FlexFEC subsystem. RTP header extensions need |
| 1082 auto it_bounds = flexfec_receive_ssrcs_media_.equal_range(ssrc); | 1147 // not be parsed, as FlexFEC is oblivious to the semantic meaning of the |
| 1083 for (auto it = it_bounds.first; it != it_bounds.second; ++it) | 1148 // packet contents beyond the 12 byte RTP base header. The BWE is fed |
| 1084 it->second->AddAndProcessReceivedPacket(packet, length); | 1149 // information about these media packets from the regular media pipeline. |
| 1085 if (status == DELIVERY_OK) | 1150 rtc::Optional<RtpPacketReceived> parsed_packet = |
| 1086 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length); | 1151 ParseRtpPacket(packet, length, packet_time, nullptr); |
| 1087 return status; | 1152 if (parsed_packet) { |
| 1153 auto it_bounds = flexfec_receive_ssrcs_media_.equal_range(ssrc); | |
| 1154 for (auto it = it_bounds.first; it != it_bounds.second; ++it) | |
| 1155 it->second->AddAndProcessReceivedPacket(*parsed_packet); | |
| 1156 if (status == DELIVERY_OK) | |
| 1157 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length); | |
| 1158 return status; | |
| 1159 } | |
| 1088 } | 1160 } |
| 1089 } | 1161 } |
| 1090 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) { | 1162 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) { |
| 1091 auto it = flexfec_receive_ssrcs_protection_.find(ssrc); | 1163 auto it = flexfec_receive_ssrcs_protection_.find(ssrc); |
| 1092 if (it != flexfec_receive_ssrcs_protection_.end()) { | 1164 if (it != flexfec_receive_ssrcs_protection_.end()) { |
| 1093 auto status = it->second->AddAndProcessReceivedPacket(packet, length) | 1165 const RtpHeaderExtensionMap& extensions = |
| 1094 ? DELIVERY_OK | 1166 received_rtp_header_extensions_[ssrc]; |
| 1095 : DELIVERY_PACKET_ERROR; | 1167 rtc::Optional<RtpPacketReceived> parsed_packet = |
| 1096 if (status == DELIVERY_OK) | 1168 ParseRtpPacket(packet, length, packet_time, &extensions); |
| 1097 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length); | 1169 if (parsed_packet) { |
| 1098 return status; | 1170 auto status = |
| 1171 it->second->AddAndProcessReceivedPacket(std::move(*parsed_packet)) | |
| 1172 ? DELIVERY_OK | |
| 1173 : DELIVERY_PACKET_ERROR; | |
| 1174 if (status == DELIVERY_OK) | |
| 1175 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length); | |
| 1176 return status; | |
| 1177 } | |
| 1099 } | 1178 } |
| 1100 } | 1179 } |
| 1101 return DELIVERY_UNKNOWN_SSRC; | 1180 return DELIVERY_UNKNOWN_SSRC; |
| 1102 } | 1181 } |
| 1103 | 1182 |
| 1104 PacketReceiver::DeliveryStatus Call::DeliverPacket( | 1183 PacketReceiver::DeliveryStatus Call::DeliverPacket( |
| 1105 MediaType media_type, | 1184 MediaType media_type, |
| 1106 const uint8_t* packet, | 1185 const uint8_t* packet, |
| 1107 size_t length, | 1186 size_t length, |
| 1108 const PacketTime& packet_time) { | 1187 const PacketTime& packet_time) { |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 1122 uint32_t ssrc = ByteReader<uint32_t>::ReadBigEndian(&packet[8]); | 1201 uint32_t ssrc = ByteReader<uint32_t>::ReadBigEndian(&packet[8]); |
| 1123 ReadLockScoped read_lock(*receive_crit_); | 1202 ReadLockScoped read_lock(*receive_crit_); |
| 1124 auto it = video_receive_ssrcs_.find(ssrc); | 1203 auto it = video_receive_ssrcs_.find(ssrc); |
| 1125 if (it == video_receive_ssrcs_.end()) | 1204 if (it == video_receive_ssrcs_.end()) |
| 1126 return false; | 1205 return false; |
| 1127 return it->second->OnRecoveredPacket(packet, length); | 1206 return it->second->OnRecoveredPacket(packet, length); |
| 1128 } | 1207 } |
| 1129 | 1208 |
| 1130 } // namespace internal | 1209 } // namespace internal |
| 1131 } // namespace webrtc | 1210 } // namespace webrtc |
| OLD | NEW |