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

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

Issue 2553863003: Parse FlexFEC RTP headers in Call and add integration with BWE. (Closed)
Patch Set: Rebase and changes, including adressing danilchap's early comments. Created 4 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
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
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
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
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
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();
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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 UpdateAggregateNetworkState(); 511 UpdateAggregateNetworkState();
475 delete audio_send_stream; 512 delete audio_send_stream;
476 } 513 }
477 514
478 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( 515 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream(
479 const webrtc::AudioReceiveStream::Config& config) { 516 const webrtc::AudioReceiveStream::Config& config) {
480 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); 517 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream");
481 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 518 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
482 event_log_->LogAudioReceiveStreamConfig(config); 519 event_log_->LogAudioReceiveStreamConfig(config);
483 AudioReceiveStream* receive_stream = new AudioReceiveStream( 520 AudioReceiveStream* receive_stream = new AudioReceiveStream(
484 &packet_router_, 521 &packet_router_, congestion_controller_->GetRemoteBitrateEstimator(
485 // TODO(nisse): Used only when UseSendSideBwe(config) is true. 522 CongestionController::UseSendSideBwe(
brandtr 2016/12/12 13:51:08 Nisse: please check.
nisse-webrtc 2016/12/13 10:32:32 Maybe the TODO item was badly worded. The thing is
brandtr 2016/12/13 11:05:49 Got it, thanks. I've reverted this part of the pat
486 congestion_controller_->GetRemoteBitrateEstimator(true), config, 523 config.rtp.transport_cc,
487 config_.audio_state, event_log_); 524 RtpHeaderExtensionMap(config.rtp.extensions))),
525 config, config_.audio_state, event_log_);
488 { 526 {
489 WriteLockScoped write_lock(*receive_crit_); 527 WriteLockScoped write_lock(*receive_crit_);
490 RTC_DCHECK(audio_receive_ssrcs_.find(config.rtp.remote_ssrc) == 528 RTC_DCHECK(audio_receive_ssrcs_.find(config.rtp.remote_ssrc) ==
491 audio_receive_ssrcs_.end()); 529 audio_receive_ssrcs_.end());
492 audio_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream; 530 audio_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream;
493 ConfigureSync(config.sync_group); 531 ConfigureSync(config.sync_group);
494 } 532 }
495 { 533 {
496 ReadLockScoped read_lock(*send_crit_); 534 ReadLockScoped read_lock(*send_crit_);
497 auto it = audio_send_ssrcs_.find(config.rtp.local_ssrc); 535 auto it = audio_send_ssrcs_.find(config.rtp.local_ssrc);
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 ConfigureSync(receive_stream_impl->config().sync_group); 690 ConfigureSync(receive_stream_impl->config().sync_group);
653 } 691 }
654 UpdateAggregateNetworkState(); 692 UpdateAggregateNetworkState();
655 delete receive_stream_impl; 693 delete receive_stream_impl;
656 } 694 }
657 695
658 webrtc::FlexfecReceiveStream* Call::CreateFlexfecReceiveStream( 696 webrtc::FlexfecReceiveStream* Call::CreateFlexfecReceiveStream(
659 const webrtc::FlexfecReceiveStream::Config& config) { 697 const webrtc::FlexfecReceiveStream::Config& config) {
660 TRACE_EVENT0("webrtc", "Call::CreateFlexfecReceiveStream"); 698 TRACE_EVENT0("webrtc", "Call::CreateFlexfecReceiveStream");
661 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 699 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
662 FlexfecReceiveStream* receive_stream = new FlexfecReceiveStream(config, this); 700
701 RtpHeaderExtensionMap rtp_header_extensions(config.rtp_header_extensions);
702 RecoveredPacketReceiver* recovered_packet_receiver = this;
703 RemoteBitrateEstimator* remote_bitrate_estimator =
704 congestion_controller_->GetRemoteBitrateEstimator(
705 CongestionController::UseSendSideBwe(config.transport_cc,
706 rtp_header_extensions));
707 FlexfecReceiveStream* receive_stream = new FlexfecReceiveStream(
708 config, recovered_packet_receiver, remote_bitrate_estimator);
663 709
664 { 710 {
665 WriteLockScoped write_lock(*receive_crit_); 711 WriteLockScoped write_lock(*receive_crit_);
712
713 RTC_DCHECK(flexfec_receive_streams_.find(receive_stream) ==
714 flexfec_receive_streams_.end());
715 flexfec_receive_streams_.insert(receive_stream);
716
666 for (auto ssrc : config.protected_media_ssrcs) 717 for (auto ssrc : config.protected_media_ssrcs)
667 flexfec_receive_ssrcs_media_.insert(std::make_pair(ssrc, receive_stream)); 718 flexfec_receive_ssrcs_media_.insert(std::make_pair(ssrc, receive_stream));
719
668 RTC_DCHECK(flexfec_receive_ssrcs_protection_.find(config.remote_ssrc) == 720 RTC_DCHECK(flexfec_receive_ssrcs_protection_.find(config.remote_ssrc) ==
669 flexfec_receive_ssrcs_protection_.end()); 721 flexfec_receive_ssrcs_protection_.end());
670 flexfec_receive_ssrcs_protection_[config.remote_ssrc] = receive_stream; 722 flexfec_receive_ssrcs_protection_[config.remote_ssrc] = receive_stream;
671 flexfec_receive_streams_.insert(receive_stream); 723
724 RTC_DCHECK(received_rtp_header_extensions_.find(config.remote_ssrc) ==
725 received_rtp_header_extensions_.end());
726 received_rtp_header_extensions_[config.remote_ssrc] = rtp_header_extensions;
672 } 727 }
728
673 // TODO(brandtr): Store config in RtcEventLog here. 729 // TODO(brandtr): Store config in RtcEventLog here.
730
674 return receive_stream; 731 return receive_stream;
675 } 732 }
676 733
677 void Call::DestroyFlexfecReceiveStream( 734 void Call::DestroyFlexfecReceiveStream(
678 webrtc::FlexfecReceiveStream* receive_stream) { 735 webrtc::FlexfecReceiveStream* receive_stream) {
679 TRACE_EVENT0("webrtc", "Call::DestroyFlexfecReceiveStream"); 736 TRACE_EVENT0("webrtc", "Call::DestroyFlexfecReceiveStream");
680 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 737 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
738
681 RTC_DCHECK(receive_stream != nullptr); 739 RTC_DCHECK(receive_stream != nullptr);
740
682 // There exist no other derived classes of webrtc::FlexfecReceiveStream, 741 // There exist no other derived classes of webrtc::FlexfecReceiveStream,
683 // so this downcast is safe. 742 // so this downcast is safe.
684 FlexfecReceiveStream* receive_stream_impl = 743 FlexfecReceiveStream* receive_stream_impl =
685 static_cast<FlexfecReceiveStream*>(receive_stream); 744 static_cast<FlexfecReceiveStream*>(receive_stream);
745 uint32_t ssrc = receive_stream_impl->GetConfig().remote_ssrc;
746
686 { 747 {
687 WriteLockScoped write_lock(*receive_crit_); 748 WriteLockScoped write_lock(*receive_crit_);
749
750 received_rtp_header_extensions_.erase(ssrc);
751
688 // Remove all SSRCs pointing to the FlexfecReceiveStream to be destroyed. 752 // 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(); 753 auto prot_it = flexfec_receive_ssrcs_protection_.begin();
697 while (prot_it != flexfec_receive_ssrcs_protection_.end()) { 754 while (prot_it != flexfec_receive_ssrcs_protection_.end()) {
698 if (prot_it->second == receive_stream_impl) 755 if (prot_it->second == receive_stream_impl)
699 prot_it = flexfec_receive_ssrcs_protection_.erase(prot_it); 756 prot_it = flexfec_receive_ssrcs_protection_.erase(prot_it);
700 else 757 else
701 ++prot_it; 758 ++prot_it;
702 } 759 }
760 auto media_it = flexfec_receive_ssrcs_media_.begin();
761 while (media_it != flexfec_receive_ssrcs_media_.end()) {
762 if (media_it->second == receive_stream_impl)
763 media_it = flexfec_receive_ssrcs_media_.erase(media_it);
764 else
765 ++media_it;
766 }
767
703 flexfec_receive_streams_.erase(receive_stream_impl); 768 flexfec_receive_streams_.erase(receive_stream_impl);
704 } 769 }
770
705 delete receive_stream_impl; 771 delete receive_stream_impl;
706 } 772 }
707 773
708 Call::Stats Call::GetStats() const { 774 Call::Stats Call::GetStats() const {
709 // TODO(solenberg): Some test cases in EndToEndTest use this from a different 775 // TODO(solenberg): Some test cases in EndToEndTest use this from a different
710 // thread. Re-enable once that is fixed. 776 // thread. Re-enable once that is fixed.
711 // RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 777 // RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
712 Stats stats; 778 Stats stats;
713 // Fetch available send/receive bitrates. 779 // Fetch available send/receive bitrates.
714 uint32_t send_bandwidth = 0; 780 uint32_t send_bandwidth = 0;
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 } 1137 }
1072 } 1138 }
1073 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) { 1139 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) {
1074 auto it = video_receive_ssrcs_.find(ssrc); 1140 auto it = video_receive_ssrcs_.find(ssrc);
1075 if (it != video_receive_ssrcs_.end()) { 1141 if (it != video_receive_ssrcs_.end()) {
1076 received_bytes_per_second_counter_.Add(static_cast<int>(length)); 1142 received_bytes_per_second_counter_.Add(static_cast<int>(length));
1077 received_video_bytes_per_second_counter_.Add(static_cast<int>(length)); 1143 received_video_bytes_per_second_counter_.Add(static_cast<int>(length));
1078 auto status = it->second->DeliverRtp(packet, length, packet_time) 1144 auto status = it->second->DeliverRtp(packet, length, packet_time)
1079 ? DELIVERY_OK 1145 ? DELIVERY_OK
1080 : DELIVERY_PACKET_ERROR; 1146 : DELIVERY_PACKET_ERROR;
1081 // Deliver media packets to FlexFEC subsystem. 1147 // Deliver media packets to FlexFEC subsystem. RTP header extensions need
1082 auto it_bounds = flexfec_receive_ssrcs_media_.equal_range(ssrc); 1148 // 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) 1149 // packet contents beyond the 12 byte RTP base header. The BWE is fed
1084 it->second->AddAndProcessReceivedPacket(packet, length); 1150 // information about these media packets from the regular media pipeline.
1085 if (status == DELIVERY_OK) 1151 rtc::Optional<RtpPacketReceived> parsed_packet =
1086 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length); 1152 ParseRtpPacket(packet, length, packet_time, nullptr);
1087 return status; 1153 if (parsed_packet) {
1154 auto it_bounds = flexfec_receive_ssrcs_media_.equal_range(ssrc);
1155 for (auto it = it_bounds.first; it != it_bounds.second; ++it)
1156 it->second->AddAndProcessReceivedPacket(*parsed_packet);
1157 if (status == DELIVERY_OK)
1158 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length);
1159 return status;
1160 }
1088 } 1161 }
1089 } 1162 }
1090 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) { 1163 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) {
1091 auto it = flexfec_receive_ssrcs_protection_.find(ssrc); 1164 auto it = flexfec_receive_ssrcs_protection_.find(ssrc);
1092 if (it != flexfec_receive_ssrcs_protection_.end()) { 1165 if (it != flexfec_receive_ssrcs_protection_.end()) {
1093 auto status = it->second->AddAndProcessReceivedPacket(packet, length) 1166 const RtpHeaderExtensionMap& extensions =
1094 ? DELIVERY_OK 1167 received_rtp_header_extensions_[ssrc];
1095 : DELIVERY_PACKET_ERROR; 1168 rtc::Optional<RtpPacketReceived> parsed_packet =
1096 if (status == DELIVERY_OK) 1169 ParseRtpPacket(packet, length, packet_time, &extensions);
1097 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length); 1170 if (parsed_packet) {
1098 return status; 1171 auto status =
1172 it->second->AddAndProcessReceivedPacket(std::move(*parsed_packet))
1173 ? DELIVERY_OK
1174 : DELIVERY_PACKET_ERROR;
1175 if (status == DELIVERY_OK)
1176 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length);
1177 return status;
1178 }
1099 } 1179 }
1100 } 1180 }
1101 return DELIVERY_UNKNOWN_SSRC; 1181 return DELIVERY_UNKNOWN_SSRC;
1102 } 1182 }
1103 1183
1104 PacketReceiver::DeliveryStatus Call::DeliverPacket( 1184 PacketReceiver::DeliveryStatus Call::DeliverPacket(
1105 MediaType media_type, 1185 MediaType media_type,
1106 const uint8_t* packet, 1186 const uint8_t* packet,
1107 size_t length, 1187 size_t length,
1108 const PacketTime& packet_time) { 1188 const PacketTime& packet_time) {
(...skipping 13 matching lines...) Expand all
1122 uint32_t ssrc = ByteReader<uint32_t>::ReadBigEndian(&packet[8]); 1202 uint32_t ssrc = ByteReader<uint32_t>::ReadBigEndian(&packet[8]);
1123 ReadLockScoped read_lock(*receive_crit_); 1203 ReadLockScoped read_lock(*receive_crit_);
1124 auto it = video_receive_ssrcs_.find(ssrc); 1204 auto it = video_receive_ssrcs_.find(ssrc);
1125 if (it == video_receive_ssrcs_.end()) 1205 if (it == video_receive_ssrcs_.end())
1126 return false; 1206 return false;
1127 return it->second->OnRecoveredPacket(packet, length); 1207 return it->second->OnRecoveredPacket(packet, length);
1128 } 1208 }
1129 1209
1130 } // namespace internal 1210 } // namespace internal
1131 } // namespace webrtc 1211 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698