| 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 17 matching lines...) Expand all Loading... |
| 28 #include "webrtc/call.h" | 28 #include "webrtc/call.h" |
| 29 #include "webrtc/call/bitrate_allocator.h" | 29 #include "webrtc/call/bitrate_allocator.h" |
| 30 #include "webrtc/call/rtc_event_log.h" | 30 #include "webrtc/call/rtc_event_log.h" |
| 31 #include "webrtc/config.h" | 31 #include "webrtc/config.h" |
| 32 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" | 32 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" |
| 33 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" | 33 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" |
| 34 #include "webrtc/modules/pacing/paced_sender.h" | 34 #include "webrtc/modules/pacing/paced_sender.h" |
| 35 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" | 35 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" |
| 36 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 36 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
| 37 #include "webrtc/modules/utility/include/process_thread.h" | 37 #include "webrtc/modules/utility/include/process_thread.h" |
| 38 #include "webrtc/system_wrappers/include/clock.h" | |
| 39 #include "webrtc/system_wrappers/include/cpu_info.h" | 38 #include "webrtc/system_wrappers/include/cpu_info.h" |
| 40 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 39 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
| 41 #include "webrtc/system_wrappers/include/metrics.h" | 40 #include "webrtc/system_wrappers/include/metrics.h" |
| 42 #include "webrtc/system_wrappers/include/rw_lock_wrapper.h" | 41 #include "webrtc/system_wrappers/include/rw_lock_wrapper.h" |
| 43 #include "webrtc/system_wrappers/include/trace.h" | 42 #include "webrtc/system_wrappers/include/trace.h" |
| 44 #include "webrtc/video/call_stats.h" | 43 #include "webrtc/video/call_stats.h" |
| 45 #include "webrtc/video/send_delay_stats.h" | 44 #include "webrtc/video/send_delay_stats.h" |
| 46 #include "webrtc/video/video_receive_stream.h" | 45 #include "webrtc/video/video_receive_stream.h" |
| 47 #include "webrtc/video/video_send_stream.h" | 46 #include "webrtc/video/video_send_stream.h" |
| 48 #include "webrtc/video/vie_remb.h" | 47 #include "webrtc/video/vie_remb.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 void OnSentPacket(const rtc::SentPacket& sent_packet) override; | 100 void OnSentPacket(const rtc::SentPacket& sent_packet) override; |
| 102 | 101 |
| 103 // Implements BitrateObserver. | 102 // Implements BitrateObserver. |
| 104 void OnNetworkChanged(uint32_t bitrate_bps, uint8_t fraction_loss, | 103 void OnNetworkChanged(uint32_t bitrate_bps, uint8_t fraction_loss, |
| 105 int64_t rtt_ms) override; | 104 int64_t rtt_ms) override; |
| 106 | 105 |
| 107 // Implements BitrateAllocator::LimitObserver. | 106 // Implements BitrateAllocator::LimitObserver. |
| 108 void OnAllocationLimitsChanged(uint32_t min_send_bitrate_bps, | 107 void OnAllocationLimitsChanged(uint32_t min_send_bitrate_bps, |
| 109 uint32_t max_padding_bitrate_bps) override; | 108 uint32_t max_padding_bitrate_bps) override; |
| 110 | 109 |
| 111 bool StartEventLog(rtc::PlatformFile log_file, | |
| 112 int64_t max_size_bytes) override { | |
| 113 return event_log_->StartLogging(log_file, max_size_bytes); | |
| 114 } | |
| 115 | |
| 116 void StopEventLog() override { event_log_->StopLogging(); } | |
| 117 | |
| 118 private: | 110 private: |
| 119 DeliveryStatus DeliverRtcp(MediaType media_type, const uint8_t* packet, | 111 DeliveryStatus DeliverRtcp(MediaType media_type, const uint8_t* packet, |
| 120 size_t length); | 112 size_t length); |
| 121 DeliveryStatus DeliverRtp(MediaType media_type, | 113 DeliveryStatus DeliverRtp(MediaType media_type, |
| 122 const uint8_t* packet, | 114 const uint8_t* packet, |
| 123 size_t length, | 115 size_t length, |
| 124 const PacketTime& packet_time); | 116 const PacketTime& packet_time); |
| 125 void ConfigureSync(const std::string& sync_group) | 117 void ConfigureSync(const std::string& sync_group) |
| 126 EXCLUSIVE_LOCKS_REQUIRED(receive_crit_); | 118 EXCLUSIVE_LOCKS_REQUIRED(receive_crit_); |
| 127 | 119 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 GUARDED_BY(receive_crit_); | 155 GUARDED_BY(receive_crit_); |
| 164 | 156 |
| 165 std::unique_ptr<RWLockWrapper> send_crit_; | 157 std::unique_ptr<RWLockWrapper> send_crit_; |
| 166 // Audio and Video send streams are owned by the client that creates them. | 158 // Audio and Video send streams are owned by the client that creates them. |
| 167 std::map<uint32_t, AudioSendStream*> audio_send_ssrcs_ GUARDED_BY(send_crit_); | 159 std::map<uint32_t, AudioSendStream*> audio_send_ssrcs_ GUARDED_BY(send_crit_); |
| 168 std::map<uint32_t, VideoSendStream*> video_send_ssrcs_ GUARDED_BY(send_crit_); | 160 std::map<uint32_t, VideoSendStream*> video_send_ssrcs_ GUARDED_BY(send_crit_); |
| 169 std::set<VideoSendStream*> video_send_streams_ GUARDED_BY(send_crit_); | 161 std::set<VideoSendStream*> video_send_streams_ GUARDED_BY(send_crit_); |
| 170 | 162 |
| 171 VideoSendStream::RtpStateMap suspended_video_send_ssrcs_; | 163 VideoSendStream::RtpStateMap suspended_video_send_ssrcs_; |
| 172 | 164 |
| 173 std::unique_ptr<webrtc::RtcEventLog> event_log_; | 165 RtcEventLog* event_log_ = nullptr; |
| 174 | 166 |
| 175 // The following members are only accessed (exclusively) from one thread and | 167 // The following members are only accessed (exclusively) from one thread and |
| 176 // from the destructor, and therefore doesn't need any explicit | 168 // from the destructor, and therefore doesn't need any explicit |
| 177 // synchronization. | 169 // synchronization. |
| 178 int64_t received_video_bytes_; | 170 int64_t received_video_bytes_; |
| 179 int64_t received_audio_bytes_; | 171 int64_t received_audio_bytes_; |
| 180 int64_t received_rtcp_bytes_; | 172 int64_t received_rtcp_bytes_; |
| 181 int64_t first_rtp_packet_received_ms_; | 173 int64_t first_rtp_packet_received_ms_; |
| 182 int64_t last_rtp_packet_received_ms_; | 174 int64_t last_rtp_packet_received_ms_; |
| 183 int64_t first_packet_sent_ms_; | 175 int64_t first_packet_sent_ms_; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 211 num_cpu_cores_(CpuInfo::DetectNumberOfCores()), | 203 num_cpu_cores_(CpuInfo::DetectNumberOfCores()), |
| 212 module_process_thread_(ProcessThread::Create("ModuleProcessThread")), | 204 module_process_thread_(ProcessThread::Create("ModuleProcessThread")), |
| 213 pacer_thread_(ProcessThread::Create("PacerThread")), | 205 pacer_thread_(ProcessThread::Create("PacerThread")), |
| 214 call_stats_(new CallStats(clock_)), | 206 call_stats_(new CallStats(clock_)), |
| 215 bitrate_allocator_(new BitrateAllocator(this)), | 207 bitrate_allocator_(new BitrateAllocator(this)), |
| 216 config_(config), | 208 config_(config), |
| 217 audio_network_state_(kNetworkUp), | 209 audio_network_state_(kNetworkUp), |
| 218 video_network_state_(kNetworkUp), | 210 video_network_state_(kNetworkUp), |
| 219 receive_crit_(RWLockWrapper::CreateRWLock()), | 211 receive_crit_(RWLockWrapper::CreateRWLock()), |
| 220 send_crit_(RWLockWrapper::CreateRWLock()), | 212 send_crit_(RWLockWrapper::CreateRWLock()), |
| 221 event_log_(RtcEventLog::Create(webrtc::Clock::GetRealTimeClock())), | |
| 222 received_video_bytes_(0), | 213 received_video_bytes_(0), |
| 223 received_audio_bytes_(0), | 214 received_audio_bytes_(0), |
| 224 received_rtcp_bytes_(0), | 215 received_rtcp_bytes_(0), |
| 225 first_rtp_packet_received_ms_(-1), | 216 first_rtp_packet_received_ms_(-1), |
| 226 last_rtp_packet_received_ms_(-1), | 217 last_rtp_packet_received_ms_(-1), |
| 227 first_packet_sent_ms_(-1), | 218 first_packet_sent_ms_(-1), |
| 228 estimated_send_bitrate_sum_kbits_(0), | 219 estimated_send_bitrate_sum_kbits_(0), |
| 229 pacer_bitrate_sum_kbits_(0), | 220 pacer_bitrate_sum_kbits_(0), |
| 230 min_allocated_send_bitrate_bps_(0), | 221 min_allocated_send_bitrate_bps_(0), |
| 231 num_bitrate_updates_(0), | 222 num_bitrate_updates_(0), |
| 232 remb_(clock_), | 223 remb_(clock_), |
| 233 congestion_controller_( | 224 congestion_controller_(new CongestionController(clock_, this, &remb_)), |
| 234 new CongestionController(clock_, this, &remb_, event_log_.get())), | |
| 235 video_send_delay_stats_(new SendDelayStats(clock_)) { | 225 video_send_delay_stats_(new SendDelayStats(clock_)) { |
| 236 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 226 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
| 237 RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0); | 227 RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0); |
| 238 RTC_DCHECK_GE(config.bitrate_config.start_bitrate_bps, | 228 RTC_DCHECK_GE(config.bitrate_config.start_bitrate_bps, |
| 239 config.bitrate_config.min_bitrate_bps); | 229 config.bitrate_config.min_bitrate_bps); |
| 240 if (config.bitrate_config.max_bitrate_bps != -1) { | 230 if (config.bitrate_config.max_bitrate_bps != -1) { |
| 241 RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps, | 231 RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps, |
| 242 config.bitrate_config.start_bitrate_bps); | 232 config.bitrate_config.start_bitrate_bps); |
| 243 } | 233 } |
| 234 if (config.audio_state.get()) { |
| 235 ScopedVoEInterface<VoECodec> voe_codec(voice_engine()); |
| 236 event_log_ = voe_codec->GetEventLog(); |
| 237 } |
| 244 | 238 |
| 245 Trace::CreateTrace(); | 239 Trace::CreateTrace(); |
| 246 call_stats_->RegisterStatsObserver(congestion_controller_.get()); | 240 call_stats_->RegisterStatsObserver(congestion_controller_.get()); |
| 247 | 241 |
| 248 congestion_controller_->SetBweBitrates( | 242 congestion_controller_->SetBweBitrates( |
| 249 config_.bitrate_config.min_bitrate_bps, | 243 config_.bitrate_config.min_bitrate_bps, |
| 250 config_.bitrate_config.start_bitrate_bps, | 244 config_.bitrate_config.start_bitrate_bps, |
| 251 config_.bitrate_config.max_bitrate_bps); | 245 config_.bitrate_config.max_bitrate_bps); |
| 246 congestion_controller_->GetBitrateController()->SetEventLog(event_log_); |
| 252 | 247 |
| 253 module_process_thread_->Start(); | 248 module_process_thread_->Start(); |
| 254 module_process_thread_->RegisterModule(call_stats_.get()); | 249 module_process_thread_->RegisterModule(call_stats_.get()); |
| 255 module_process_thread_->RegisterModule(congestion_controller_.get()); | 250 module_process_thread_->RegisterModule(congestion_controller_.get()); |
| 256 pacer_thread_->RegisterModule(congestion_controller_->pacer()); | 251 pacer_thread_->RegisterModule(congestion_controller_->pacer()); |
| 257 pacer_thread_->RegisterModule( | 252 pacer_thread_->RegisterModule( |
| 258 congestion_controller_->GetRemoteBitrateEstimator(true)); | 253 congestion_controller_->GetRemoteBitrateEstimator(true)); |
| 259 pacer_thread_->Start(); | 254 pacer_thread_->Start(); |
| 260 } | 255 } |
| 261 | 256 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 RTC_DCHECK(num_deleted == 1); | 364 RTC_DCHECK(num_deleted == 1); |
| 370 } | 365 } |
| 371 UpdateAggregateNetworkState(); | 366 UpdateAggregateNetworkState(); |
| 372 delete audio_send_stream; | 367 delete audio_send_stream; |
| 373 } | 368 } |
| 374 | 369 |
| 375 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( | 370 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( |
| 376 const webrtc::AudioReceiveStream::Config& config) { | 371 const webrtc::AudioReceiveStream::Config& config) { |
| 377 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); | 372 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); |
| 378 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 373 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
| 379 AudioReceiveStream* receive_stream = | 374 AudioReceiveStream* receive_stream = new AudioReceiveStream( |
| 380 new AudioReceiveStream(congestion_controller_.get(), config, | 375 congestion_controller_.get(), config, config_.audio_state); |
| 381 config_.audio_state, event_log_.get()); | |
| 382 { | 376 { |
| 383 WriteLockScoped write_lock(*receive_crit_); | 377 WriteLockScoped write_lock(*receive_crit_); |
| 384 RTC_DCHECK(audio_receive_ssrcs_.find(config.rtp.remote_ssrc) == | 378 RTC_DCHECK(audio_receive_ssrcs_.find(config.rtp.remote_ssrc) == |
| 385 audio_receive_ssrcs_.end()); | 379 audio_receive_ssrcs_.end()); |
| 386 audio_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream; | 380 audio_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream; |
| 387 ConfigureSync(config.sync_group); | 381 ConfigureSync(config.sync_group); |
| 388 } | 382 } |
| 389 receive_stream->SignalNetworkState(audio_network_state_); | 383 receive_stream->SignalNetworkState(audio_network_state_); |
| 390 UpdateAggregateNetworkState(); | 384 UpdateAggregateNetworkState(); |
| 391 return receive_stream; | 385 return receive_stream; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 420 const VideoEncoderConfig& encoder_config) { | 414 const VideoEncoderConfig& encoder_config) { |
| 421 TRACE_EVENT0("webrtc", "Call::CreateVideoSendStream"); | 415 TRACE_EVENT0("webrtc", "Call::CreateVideoSendStream"); |
| 422 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 416 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
| 423 | 417 |
| 424 video_send_delay_stats_->AddSsrcs(config); | 418 video_send_delay_stats_->AddSsrcs(config); |
| 425 // TODO(mflodman): Base the start bitrate on a current bandwidth estimate, if | 419 // TODO(mflodman): Base the start bitrate on a current bandwidth estimate, if |
| 426 // the call has already started. | 420 // the call has already started. |
| 427 VideoSendStream* send_stream = new VideoSendStream( | 421 VideoSendStream* send_stream = new VideoSendStream( |
| 428 num_cpu_cores_, module_process_thread_.get(), call_stats_.get(), | 422 num_cpu_cores_, module_process_thread_.get(), call_stats_.get(), |
| 429 congestion_controller_.get(), bitrate_allocator_.get(), | 423 congestion_controller_.get(), bitrate_allocator_.get(), |
| 430 video_send_delay_stats_.get(), &remb_, event_log_.get(), config, | 424 video_send_delay_stats_.get(), &remb_, event_log_, config, encoder_config, |
| 431 encoder_config, suspended_video_send_ssrcs_); | 425 suspended_video_send_ssrcs_); |
| 432 { | 426 { |
| 433 WriteLockScoped write_lock(*send_crit_); | 427 WriteLockScoped write_lock(*send_crit_); |
| 434 for (uint32_t ssrc : config.rtp.ssrcs) { | 428 for (uint32_t ssrc : config.rtp.ssrcs) { |
| 435 RTC_DCHECK(video_send_ssrcs_.find(ssrc) == video_send_ssrcs_.end()); | 429 RTC_DCHECK(video_send_ssrcs_.find(ssrc) == video_send_ssrcs_.end()); |
| 436 video_send_ssrcs_[ssrc] = send_stream; | 430 video_send_ssrcs_[ssrc] = send_stream; |
| 437 } | 431 } |
| 438 video_send_streams_.insert(send_stream); | 432 video_send_streams_.insert(send_stream); |
| 439 } | 433 } |
| 440 send_stream->SignalNetworkState(video_network_state_); | 434 send_stream->SignalNetworkState(video_network_state_); |
| 441 UpdateAggregateNetworkState(); | 435 UpdateAggregateNetworkState(); |
| 442 event_log_->LogVideoSendStreamConfig(config); | 436 if (event_log_) |
| 437 event_log_->LogVideoSendStreamConfig(config); |
| 443 return send_stream; | 438 return send_stream; |
| 444 } | 439 } |
| 445 | 440 |
| 446 void Call::DestroyVideoSendStream(webrtc::VideoSendStream* send_stream) { | 441 void Call::DestroyVideoSendStream(webrtc::VideoSendStream* send_stream) { |
| 447 TRACE_EVENT0("webrtc", "Call::DestroyVideoSendStream"); | 442 TRACE_EVENT0("webrtc", "Call::DestroyVideoSendStream"); |
| 448 RTC_DCHECK(send_stream != nullptr); | 443 RTC_DCHECK(send_stream != nullptr); |
| 449 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 444 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
| 450 | 445 |
| 451 send_stream->Stop(); | 446 send_stream->Stop(); |
| 452 | 447 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 WriteLockScoped write_lock(*receive_crit_); | 486 WriteLockScoped write_lock(*receive_crit_); |
| 492 RTC_DCHECK(video_receive_ssrcs_.find(config.rtp.remote_ssrc) == | 487 RTC_DCHECK(video_receive_ssrcs_.find(config.rtp.remote_ssrc) == |
| 493 video_receive_ssrcs_.end()); | 488 video_receive_ssrcs_.end()); |
| 494 video_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream; | 489 video_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream; |
| 495 // TODO(pbos): Configure different RTX payloads per receive payload. | 490 // TODO(pbos): Configure different RTX payloads per receive payload. |
| 496 VideoReceiveStream::Config::Rtp::RtxMap::const_iterator it = | 491 VideoReceiveStream::Config::Rtp::RtxMap::const_iterator it = |
| 497 config.rtp.rtx.begin(); | 492 config.rtp.rtx.begin(); |
| 498 if (it != config.rtp.rtx.end()) | 493 if (it != config.rtp.rtx.end()) |
| 499 video_receive_ssrcs_[it->second.ssrc] = receive_stream; | 494 video_receive_ssrcs_[it->second.ssrc] = receive_stream; |
| 500 video_receive_streams_.insert(receive_stream); | 495 video_receive_streams_.insert(receive_stream); |
| 496 |
| 501 ConfigureSync(config.sync_group); | 497 ConfigureSync(config.sync_group); |
| 502 } | 498 } |
| 503 receive_stream->SignalNetworkState(video_network_state_); | 499 receive_stream->SignalNetworkState(video_network_state_); |
| 504 UpdateAggregateNetworkState(); | 500 UpdateAggregateNetworkState(); |
| 505 event_log_->LogVideoReceiveStreamConfig(config); | 501 if (event_log_) |
| 502 event_log_->LogVideoReceiveStreamConfig(config); |
| 506 return receive_stream; | 503 return receive_stream; |
| 507 } | 504 } |
| 508 | 505 |
| 509 void Call::DestroyVideoReceiveStream( | 506 void Call::DestroyVideoReceiveStream( |
| 510 webrtc::VideoReceiveStream* receive_stream) { | 507 webrtc::VideoReceiveStream* receive_stream) { |
| 511 TRACE_EVENT0("webrtc", "Call::DestroyVideoReceiveStream"); | 508 TRACE_EVENT0("webrtc", "Call::DestroyVideoReceiveStream"); |
| 512 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 509 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
| 513 RTC_DCHECK(receive_stream != nullptr); | 510 RTC_DCHECK(receive_stream != nullptr); |
| 514 VideoReceiveStream* receive_stream_impl = nullptr; | 511 VideoReceiveStream* receive_stream_impl = nullptr; |
| 515 { | 512 { |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 | 820 |
| 824 uint32_t ssrc = ByteReader<uint32_t>::ReadBigEndian(&packet[8]); | 821 uint32_t ssrc = ByteReader<uint32_t>::ReadBigEndian(&packet[8]); |
| 825 ReadLockScoped read_lock(*receive_crit_); | 822 ReadLockScoped read_lock(*receive_crit_); |
| 826 if (media_type == MediaType::ANY || media_type == MediaType::AUDIO) { | 823 if (media_type == MediaType::ANY || media_type == MediaType::AUDIO) { |
| 827 auto it = audio_receive_ssrcs_.find(ssrc); | 824 auto it = audio_receive_ssrcs_.find(ssrc); |
| 828 if (it != audio_receive_ssrcs_.end()) { | 825 if (it != audio_receive_ssrcs_.end()) { |
| 829 received_audio_bytes_ += length; | 826 received_audio_bytes_ += length; |
| 830 auto status = it->second->DeliverRtp(packet, length, packet_time) | 827 auto status = it->second->DeliverRtp(packet, length, packet_time) |
| 831 ? DELIVERY_OK | 828 ? DELIVERY_OK |
| 832 : DELIVERY_PACKET_ERROR; | 829 : DELIVERY_PACKET_ERROR; |
| 833 if (status == DELIVERY_OK) | 830 if (status == DELIVERY_OK && event_log_) |
| 834 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length); | 831 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length); |
| 835 return status; | 832 return status; |
| 836 } | 833 } |
| 837 } | 834 } |
| 838 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) { | 835 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) { |
| 839 auto it = video_receive_ssrcs_.find(ssrc); | 836 auto it = video_receive_ssrcs_.find(ssrc); |
| 840 if (it != video_receive_ssrcs_.end()) { | 837 if (it != video_receive_ssrcs_.end()) { |
| 841 received_video_bytes_ += length; | 838 received_video_bytes_ += length; |
| 842 auto status = it->second->DeliverRtp(packet, length, packet_time) | 839 auto status = it->second->DeliverRtp(packet, length, packet_time) |
| 843 ? DELIVERY_OK | 840 ? DELIVERY_OK |
| 844 : DELIVERY_PACKET_ERROR; | 841 : DELIVERY_PACKET_ERROR; |
| 845 if (status == DELIVERY_OK) | 842 if (status == DELIVERY_OK && event_log_) |
| 846 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length); | 843 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length); |
| 847 return status; | 844 return status; |
| 848 } | 845 } |
| 849 } | 846 } |
| 850 return DELIVERY_UNKNOWN_SSRC; | 847 return DELIVERY_UNKNOWN_SSRC; |
| 851 } | 848 } |
| 852 | 849 |
| 853 PacketReceiver::DeliveryStatus Call::DeliverPacket( | 850 PacketReceiver::DeliveryStatus Call::DeliverPacket( |
| 854 MediaType media_type, | 851 MediaType media_type, |
| 855 const uint8_t* packet, | 852 const uint8_t* packet, |
| 856 size_t length, | 853 size_t length, |
| 857 const PacketTime& packet_time) { | 854 const PacketTime& packet_time) { |
| 858 // TODO(solenberg): Tests call this function on a network thread, libjingle | 855 // TODO(solenberg): Tests call this function on a network thread, libjingle |
| 859 // calls on the worker thread. We should move towards always using a network | 856 // calls on the worker thread. We should move towards always using a network |
| 860 // thread. Then this check can be enabled. | 857 // thread. Then this check can be enabled. |
| 861 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); | 858 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); |
| 862 if (RtpHeaderParser::IsRtcp(packet, length)) | 859 if (RtpHeaderParser::IsRtcp(packet, length)) |
| 863 return DeliverRtcp(media_type, packet, length); | 860 return DeliverRtcp(media_type, packet, length); |
| 864 | 861 |
| 865 return DeliverRtp(media_type, packet, length, packet_time); | 862 return DeliverRtp(media_type, packet, length, packet_time); |
| 866 } | 863 } |
| 867 | 864 |
| 868 } // namespace internal | 865 } // namespace internal |
| 869 } // namespace webrtc | 866 } // namespace webrtc |
| OLD | NEW |