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 15 matching lines...) Expand all Loading... | |
| 26 #include "webrtc/base/location.h" | 26 #include "webrtc/base/location.h" |
| 27 #include "webrtc/base/logging.h" | 27 #include "webrtc/base/logging.h" |
| 28 #include "webrtc/base/optional.h" | 28 #include "webrtc/base/optional.h" |
| 29 #include "webrtc/base/task_queue.h" | 29 #include "webrtc/base/task_queue.h" |
| 30 #include "webrtc/base/thread_annotations.h" | 30 #include "webrtc/base/thread_annotations.h" |
| 31 #include "webrtc/base/thread_checker.h" | 31 #include "webrtc/base/thread_checker.h" |
| 32 #include "webrtc/base/trace_event.h" | 32 #include "webrtc/base/trace_event.h" |
| 33 #include "webrtc/call/bitrate_allocator.h" | 33 #include "webrtc/call/bitrate_allocator.h" |
| 34 #include "webrtc/call/call.h" | 34 #include "webrtc/call/call.h" |
| 35 #include "webrtc/call/flexfec_receive_stream_impl.h" | 35 #include "webrtc/call/flexfec_receive_stream_impl.h" |
| 36 #include "webrtc/call/rtp_demuxer.h" | |
| 36 #include "webrtc/call/rtp_transport_controller_send.h" | 37 #include "webrtc/call/rtp_transport_controller_send.h" |
| 37 #include "webrtc/config.h" | 38 #include "webrtc/config.h" |
| 38 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 39 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
| 39 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" | 40 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" |
| 40 #include "webrtc/modules/congestion_controller/include/receive_side_congestion_c ontroller.h" | 41 #include "webrtc/modules/congestion_controller/include/receive_side_congestion_c ontroller.h" |
| 41 #include "webrtc/modules/pacing/paced_sender.h" | 42 #include "webrtc/modules/pacing/paced_sender.h" |
| 42 #include "webrtc/modules/rtp_rtcp/include/flexfec_receiver.h" | 43 #include "webrtc/modules/rtp_rtcp/include/flexfec_receiver.h" |
| 43 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" | 44 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" |
| 44 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 45 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
| 45 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" | 46 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 const std::unique_ptr<ProcessThread> pacer_thread_; | 195 const std::unique_ptr<ProcessThread> pacer_thread_; |
| 195 const std::unique_ptr<CallStats> call_stats_; | 196 const std::unique_ptr<CallStats> call_stats_; |
| 196 const std::unique_ptr<BitrateAllocator> bitrate_allocator_; | 197 const std::unique_ptr<BitrateAllocator> bitrate_allocator_; |
| 197 Call::Config config_; | 198 Call::Config config_; |
| 198 rtc::ThreadChecker configuration_thread_checker_; | 199 rtc::ThreadChecker configuration_thread_checker_; |
| 199 | 200 |
| 200 NetworkState audio_network_state_; | 201 NetworkState audio_network_state_; |
| 201 NetworkState video_network_state_; | 202 NetworkState video_network_state_; |
| 202 | 203 |
| 203 std::unique_ptr<RWLockWrapper> receive_crit_; | 204 std::unique_ptr<RWLockWrapper> receive_crit_; |
| 204 // Audio, Video, and FlexFEC receive streams are owned by the client that | 205 // Audio, Video, and FlexFEC receive streams are owned by the client that |
|
danilchap
2017/05/09 09:20:22
Why merge flexfec into video?
May be keep this CL
nisse-webrtc
2017/05/09 12:11:49
We currently support flexfec only on the video tra
| |
| 205 // creates them. | 206 // creates them. |
| 206 std::map<uint32_t, AudioReceiveStream*> audio_receive_ssrcs_ | 207 std::set<AudioReceiveStream*> audio_receive_streams_ |
| 207 GUARDED_BY(receive_crit_); | |
| 208 std::map<uint32_t, VideoReceiveStream*> video_receive_ssrcs_ | |
| 209 GUARDED_BY(receive_crit_); | 208 GUARDED_BY(receive_crit_); |
| 210 std::set<VideoReceiveStream*> video_receive_streams_ | 209 std::set<VideoReceiveStream*> video_receive_streams_ |
| 211 GUARDED_BY(receive_crit_); | 210 GUARDED_BY(receive_crit_); |
| 212 // Each media stream could conceivably be protected by multiple FlexFEC | 211 |
| 213 // streams. | |
| 214 std::multimap<uint32_t, FlexfecReceiveStreamImpl*> | |
| 215 flexfec_receive_ssrcs_media_ GUARDED_BY(receive_crit_); | |
| 216 std::map<uint32_t, FlexfecReceiveStreamImpl*> | |
| 217 flexfec_receive_ssrcs_protection_ GUARDED_BY(receive_crit_); | |
| 218 std::set<FlexfecReceiveStreamImpl*> flexfec_receive_streams_ | |
| 219 GUARDED_BY(receive_crit_); | |
| 220 std::map<std::string, AudioReceiveStream*> sync_stream_mapping_ | 212 std::map<std::string, AudioReceiveStream*> sync_stream_mapping_ |
| 221 GUARDED_BY(receive_crit_); | 213 GUARDED_BY(receive_crit_); |
| 222 | 214 |
| 215 // TODO(nisse): Should eventually be part of injected | |
| 216 // RtpTransportControllerReceive. | |
| 217 RtpDemuxer audio_rtp_demuxer_; | |
|
danilchap
2017/05/09 09:20:22
GUARDED_BY?
nisse-webrtc
2017/05/09 12:11:48
Done.
| |
| 218 RtpDemuxer video_rtp_demuxer_; | |
|
pthatcher1
2017/05/10 00:04:21
The comment on RtpDemuxer said it's "per transport
nisse-webrtc
2017/05/10 07:41:32
Currently there's a payload demuxer somewhere spli
pthatcher1
2017/05/12 00:38:51
Can you please document this, then? Because just
| |
| 219 | |
| 223 // This extra map is used for receive processing which is | 220 // This extra map is used for receive processing which is |
| 224 // independent of media type. | 221 // independent of media type. |
| 225 | 222 |
| 226 // TODO(nisse): In the RTP transport refactoring, we should have a | 223 // TODO(nisse): In the RTP transport refactoring, we should have a |
| 227 // single mapping from ssrc to a more abstract receive stream, with | 224 // single mapping from ssrc to a more abstract receive stream, with |
| 228 // accessor methods for all configuration we need at this level. | 225 // accessor methods for all configuration we need at this level. |
| 229 struct ReceiveRtpConfig { | 226 struct ReceiveRtpConfig { |
| 230 ReceiveRtpConfig() = default; // Needed by std::map | 227 ReceiveRtpConfig() = default; // Needed by std::map |
| 231 ReceiveRtpConfig(const std::vector<RtpExtension>& extensions, | 228 ReceiveRtpConfig(const std::vector<RtpExtension>& extensions, |
| 232 bool use_send_side_bwe) | 229 bool use_send_side_bwe) |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 364 | 361 |
| 365 pacer_thread_->Start(); | 362 pacer_thread_->Start(); |
| 366 } | 363 } |
| 367 | 364 |
| 368 Call::~Call() { | 365 Call::~Call() { |
| 369 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 366 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
| 370 | 367 |
| 371 RTC_CHECK(audio_send_ssrcs_.empty()); | 368 RTC_CHECK(audio_send_ssrcs_.empty()); |
| 372 RTC_CHECK(video_send_ssrcs_.empty()); | 369 RTC_CHECK(video_send_ssrcs_.empty()); |
| 373 RTC_CHECK(video_send_streams_.empty()); | 370 RTC_CHECK(video_send_streams_.empty()); |
| 374 RTC_CHECK(audio_receive_ssrcs_.empty()); | 371 RTC_CHECK(audio_receive_streams_.empty()); |
| 375 RTC_CHECK(video_receive_ssrcs_.empty()); | |
| 376 RTC_CHECK(video_receive_streams_.empty()); | 372 RTC_CHECK(video_receive_streams_.empty()); |
| 377 | 373 |
| 378 pacer_thread_->Stop(); | 374 pacer_thread_->Stop(); |
| 379 pacer_thread_->DeRegisterModule(transport_send_->send_side_cc()->pacer()); | 375 pacer_thread_->DeRegisterModule(transport_send_->send_side_cc()->pacer()); |
| 380 pacer_thread_->DeRegisterModule( | 376 pacer_thread_->DeRegisterModule( |
| 381 receive_side_cc_.GetRemoteBitrateEstimator(true)); | 377 receive_side_cc_.GetRemoteBitrateEstimator(true)); |
| 382 module_process_thread_->DeRegisterModule(transport_send_->send_side_cc()); | 378 module_process_thread_->DeRegisterModule(transport_send_->send_side_cc()); |
| 383 module_process_thread_->DeRegisterModule(&receive_side_cc_); | 379 module_process_thread_->DeRegisterModule(&receive_side_cc_); |
| 384 module_process_thread_->DeRegisterModule(call_stats_.get()); | 380 module_process_thread_->DeRegisterModule(call_stats_.get()); |
| 385 module_process_thread_->Stop(); | 381 module_process_thread_->Stop(); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 507 config, config_.audio_state, &worker_queue_, transport_send_.get(), | 503 config, config_.audio_state, &worker_queue_, transport_send_.get(), |
| 508 bitrate_allocator_.get(), event_log_, call_stats_->rtcp_rtt_stats()); | 504 bitrate_allocator_.get(), event_log_, call_stats_->rtcp_rtt_stats()); |
| 509 { | 505 { |
| 510 WriteLockScoped write_lock(*send_crit_); | 506 WriteLockScoped write_lock(*send_crit_); |
| 511 RTC_DCHECK(audio_send_ssrcs_.find(config.rtp.ssrc) == | 507 RTC_DCHECK(audio_send_ssrcs_.find(config.rtp.ssrc) == |
| 512 audio_send_ssrcs_.end()); | 508 audio_send_ssrcs_.end()); |
| 513 audio_send_ssrcs_[config.rtp.ssrc] = send_stream; | 509 audio_send_ssrcs_[config.rtp.ssrc] = send_stream; |
| 514 } | 510 } |
| 515 { | 511 { |
| 516 ReadLockScoped read_lock(*receive_crit_); | 512 ReadLockScoped read_lock(*receive_crit_); |
| 517 for (const auto& kv : audio_receive_ssrcs_) { | 513 for (AudioReceiveStream* stream : audio_receive_streams_) { |
| 518 if (kv.second->config().rtp.local_ssrc == config.rtp.ssrc) { | 514 if (stream->config().rtp.local_ssrc == config.rtp.ssrc) { |
| 519 kv.second->AssociateSendStream(send_stream); | 515 stream->AssociateSendStream(send_stream); |
| 520 } | 516 } |
| 521 } | 517 } |
| 522 } | 518 } |
| 523 send_stream->SignalNetworkState(audio_network_state_); | 519 send_stream->SignalNetworkState(audio_network_state_); |
| 524 UpdateAggregateNetworkState(); | 520 UpdateAggregateNetworkState(); |
| 525 return send_stream; | 521 return send_stream; |
| 526 } | 522 } |
| 527 | 523 |
| 528 void Call::DestroyAudioSendStream(webrtc::AudioSendStream* send_stream) { | 524 void Call::DestroyAudioSendStream(webrtc::AudioSendStream* send_stream) { |
| 529 TRACE_EVENT0("webrtc", "Call::DestroyAudioSendStream"); | 525 TRACE_EVENT0("webrtc", "Call::DestroyAudioSendStream"); |
| 530 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 526 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
| 531 RTC_DCHECK(send_stream != nullptr); | 527 RTC_DCHECK(send_stream != nullptr); |
| 532 | 528 |
| 533 send_stream->Stop(); | 529 send_stream->Stop(); |
| 534 | 530 |
| 535 webrtc::internal::AudioSendStream* audio_send_stream = | 531 webrtc::internal::AudioSendStream* audio_send_stream = |
| 536 static_cast<webrtc::internal::AudioSendStream*>(send_stream); | 532 static_cast<webrtc::internal::AudioSendStream*>(send_stream); |
| 537 uint32_t ssrc = audio_send_stream->config().rtp.ssrc; | 533 uint32_t ssrc = audio_send_stream->config().rtp.ssrc; |
| 538 { | 534 { |
| 539 WriteLockScoped write_lock(*send_crit_); | 535 WriteLockScoped write_lock(*send_crit_); |
| 540 size_t num_deleted = audio_send_ssrcs_.erase(ssrc); | 536 size_t num_deleted = audio_send_ssrcs_.erase(ssrc); |
| 541 RTC_DCHECK_EQ(1, num_deleted); | 537 RTC_DCHECK_EQ(1, num_deleted); |
| 542 } | 538 } |
| 543 { | 539 { |
| 544 ReadLockScoped read_lock(*receive_crit_); | 540 ReadLockScoped read_lock(*receive_crit_); |
| 545 for (const auto& kv : audio_receive_ssrcs_) { | 541 for (AudioReceiveStream* stream : audio_receive_streams_) { |
| 546 if (kv.second->config().rtp.local_ssrc == ssrc) { | 542 if (stream->config().rtp.local_ssrc == ssrc) { |
| 547 kv.second->AssociateSendStream(nullptr); | 543 stream->AssociateSendStream(nullptr); |
| 548 } | 544 } |
| 549 } | 545 } |
| 550 } | 546 } |
| 551 UpdateAggregateNetworkState(); | 547 UpdateAggregateNetworkState(); |
| 552 delete audio_send_stream; | 548 delete audio_send_stream; |
| 553 } | 549 } |
| 554 | 550 |
| 555 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( | 551 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( |
| 556 const webrtc::AudioReceiveStream::Config& config) { | 552 const webrtc::AudioReceiveStream::Config& config) { |
| 557 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); | 553 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); |
| 558 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 554 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
| 559 event_log_->LogAudioReceiveStreamConfig(config); | 555 event_log_->LogAudioReceiveStreamConfig(config); |
| 560 AudioReceiveStream* receive_stream = | 556 AudioReceiveStream* receive_stream = |
| 561 new AudioReceiveStream(transport_send_->packet_router(), config, | 557 new AudioReceiveStream(transport_send_->packet_router(), config, |
| 562 config_.audio_state, event_log_); | 558 config_.audio_state, event_log_); |
| 563 { | 559 { |
| 564 WriteLockScoped write_lock(*receive_crit_); | 560 WriteLockScoped write_lock(*receive_crit_); |
| 565 RTC_DCHECK(audio_receive_ssrcs_.find(config.rtp.remote_ssrc) == | 561 audio_rtp_demuxer_.AddSink(config.rtp.remote_ssrc, receive_stream); |
| 566 audio_receive_ssrcs_.end()); | |
| 567 audio_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream; | |
| 568 receive_rtp_config_[config.rtp.remote_ssrc] = | 562 receive_rtp_config_[config.rtp.remote_ssrc] = |
| 569 ReceiveRtpConfig(config.rtp.extensions, UseSendSideBwe(config)); | 563 ReceiveRtpConfig(config.rtp.extensions, UseSendSideBwe(config)); |
| 564 audio_receive_streams_.insert(receive_stream); | |
| 570 | 565 |
| 571 ConfigureSync(config.sync_group); | 566 ConfigureSync(config.sync_group); |
| 572 } | 567 } |
| 573 { | 568 { |
| 574 ReadLockScoped read_lock(*send_crit_); | 569 ReadLockScoped read_lock(*send_crit_); |
| 575 auto it = audio_send_ssrcs_.find(config.rtp.local_ssrc); | 570 auto it = audio_send_ssrcs_.find(config.rtp.local_ssrc); |
| 576 if (it != audio_send_ssrcs_.end()) { | 571 if (it != audio_send_ssrcs_.end()) { |
| 577 receive_stream->AssociateSendStream(it->second); | 572 receive_stream->AssociateSendStream(it->second); |
| 578 } | 573 } |
| 579 } | 574 } |
| 580 receive_stream->SignalNetworkState(audio_network_state_); | 575 receive_stream->SignalNetworkState(audio_network_state_); |
| 581 UpdateAggregateNetworkState(); | 576 UpdateAggregateNetworkState(); |
| 582 return receive_stream; | 577 return receive_stream; |
| 583 } | 578 } |
| 584 | 579 |
| 585 void Call::DestroyAudioReceiveStream( | 580 void Call::DestroyAudioReceiveStream( |
| 586 webrtc::AudioReceiveStream* receive_stream) { | 581 webrtc::AudioReceiveStream* receive_stream) { |
| 587 TRACE_EVENT0("webrtc", "Call::DestroyAudioReceiveStream"); | 582 TRACE_EVENT0("webrtc", "Call::DestroyAudioReceiveStream"); |
| 588 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 583 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
| 589 RTC_DCHECK(receive_stream != nullptr); | 584 RTC_DCHECK(receive_stream != nullptr); |
| 590 webrtc::internal::AudioReceiveStream* audio_receive_stream = | 585 webrtc::internal::AudioReceiveStream* audio_receive_stream = |
| 591 static_cast<webrtc::internal::AudioReceiveStream*>(receive_stream); | 586 static_cast<webrtc::internal::AudioReceiveStream*>(receive_stream); |
| 592 { | 587 { |
| 593 WriteLockScoped write_lock(*receive_crit_); | 588 WriteLockScoped write_lock(*receive_crit_); |
| 594 const AudioReceiveStream::Config& config = audio_receive_stream->config(); | 589 const AudioReceiveStream::Config& config = audio_receive_stream->config(); |
| 595 uint32_t ssrc = config.rtp.remote_ssrc; | 590 uint32_t ssrc = config.rtp.remote_ssrc; |
| 596 receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(config)) | 591 receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(config)) |
| 597 ->RemoveStream(ssrc); | 592 ->RemoveStream(ssrc); |
| 598 size_t num_deleted = audio_receive_ssrcs_.erase(ssrc); | 593 audio_rtp_demuxer_.RemoveSink(audio_receive_stream); |
| 599 RTC_DCHECK(num_deleted == 1); | 594 audio_receive_streams_.erase(audio_receive_stream); |
|
danilchap
2017/05/09 09:20:22
may be move DCHECK that something was deleted insi
nisse-webrtc
2017/05/09 12:11:49
I can let RemoveSink return a deletion count, and
| |
| 600 const std::string& sync_group = audio_receive_stream->config().sync_group; | 595 const std::string& sync_group = audio_receive_stream->config().sync_group; |
| 601 const auto it = sync_stream_mapping_.find(sync_group); | 596 const auto it = sync_stream_mapping_.find(sync_group); |
| 602 if (it != sync_stream_mapping_.end() && | 597 if (it != sync_stream_mapping_.end() && |
| 603 it->second == audio_receive_stream) { | 598 it->second == audio_receive_stream) { |
| 604 sync_stream_mapping_.erase(it); | 599 sync_stream_mapping_.erase(it); |
| 605 ConfigureSync(sync_group); | 600 ConfigureSync(sync_group); |
| 606 } | 601 } |
| 607 receive_rtp_config_.erase(ssrc); | 602 receive_rtp_config_.erase(ssrc); |
| 608 } | 603 } |
| 609 UpdateAggregateNetworkState(); | 604 UpdateAggregateNetworkState(); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 686 VideoReceiveStream* receive_stream = | 681 VideoReceiveStream* receive_stream = |
| 687 new VideoReceiveStream(num_cpu_cores_, transport_send_->packet_router(), | 682 new VideoReceiveStream(num_cpu_cores_, transport_send_->packet_router(), |
| 688 std::move(configuration), | 683 std::move(configuration), |
| 689 module_process_thread_.get(), call_stats_.get()); | 684 module_process_thread_.get(), call_stats_.get()); |
| 690 | 685 |
| 691 const webrtc::VideoReceiveStream::Config& config = receive_stream->config(); | 686 const webrtc::VideoReceiveStream::Config& config = receive_stream->config(); |
| 692 ReceiveRtpConfig receive_config(config.rtp.extensions, | 687 ReceiveRtpConfig receive_config(config.rtp.extensions, |
| 693 UseSendSideBwe(config)); | 688 UseSendSideBwe(config)); |
| 694 { | 689 { |
| 695 WriteLockScoped write_lock(*receive_crit_); | 690 WriteLockScoped write_lock(*receive_crit_); |
| 696 RTC_DCHECK(video_receive_ssrcs_.find(config.rtp.remote_ssrc) == | 691 video_rtp_demuxer_.AddSink(config.rtp.remote_ssrc, receive_stream); |
| 697 video_receive_ssrcs_.end()); | |
| 698 video_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream; | |
| 699 if (config.rtp.rtx_ssrc) { | 692 if (config.rtp.rtx_ssrc) { |
| 700 video_receive_ssrcs_[config.rtp.rtx_ssrc] = receive_stream; | 693 video_rtp_demuxer_.AddSink(config.rtp.rtx_ssrc, receive_stream); |
| 701 // We record identical config for the rtx stream as for the main | 694 // We record identical config for the rtx stream as for the main |
| 702 // stream. Since the transport_send_cc negotiation is per payload | 695 // stream. Since the transport_send_cc negotiation is per payload |
| 703 // type, we may get an incorrect value for the rtx stream, but | 696 // type, we may get an incorrect value for the rtx stream, but |
| 704 // that is unlikely to matter in practice. | 697 // that is unlikely to matter in practice. |
| 705 receive_rtp_config_[config.rtp.rtx_ssrc] = receive_config; | 698 receive_rtp_config_[config.rtp.rtx_ssrc] = receive_config; |
| 706 } | 699 } |
| 707 receive_rtp_config_[config.rtp.remote_ssrc] = receive_config; | 700 receive_rtp_config_[config.rtp.remote_ssrc] = receive_config; |
| 708 video_receive_streams_.insert(receive_stream); | 701 video_receive_streams_.insert(receive_stream); |
| 709 ConfigureSync(config.sync_group); | 702 ConfigureSync(config.sync_group); |
| 710 } | 703 } |
| 711 receive_stream->SignalNetworkState(video_network_state_); | 704 receive_stream->SignalNetworkState(video_network_state_); |
| 712 UpdateAggregateNetworkState(); | 705 UpdateAggregateNetworkState(); |
| 713 event_log_->LogVideoReceiveStreamConfig(config); | 706 event_log_->LogVideoReceiveStreamConfig(config); |
| 714 return receive_stream; | 707 return receive_stream; |
| 715 } | 708 } |
| 716 | 709 |
| 717 void Call::DestroyVideoReceiveStream( | 710 void Call::DestroyVideoReceiveStream( |
| 718 webrtc::VideoReceiveStream* receive_stream) { | 711 webrtc::VideoReceiveStream* receive_stream) { |
| 719 TRACE_EVENT0("webrtc", "Call::DestroyVideoReceiveStream"); | 712 TRACE_EVENT0("webrtc", "Call::DestroyVideoReceiveStream"); |
| 720 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 713 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
| 721 RTC_DCHECK(receive_stream != nullptr); | 714 RTC_DCHECK(receive_stream != nullptr); |
| 722 VideoReceiveStream* receive_stream_impl = nullptr; | 715 VideoReceiveStream* receive_stream_impl = |
| 716 static_cast<VideoReceiveStream*>(receive_stream); | |
| 717 const VideoReceiveStream::Config& config = receive_stream_impl->config(); | |
| 723 { | 718 { |
| 724 WriteLockScoped write_lock(*receive_crit_); | 719 WriteLockScoped write_lock(*receive_crit_); |
| 725 // Remove all ssrcs pointing to a receive stream. As RTX retransmits on a | 720 // Remove all ssrcs pointing to a receive stream. As RTX retransmits on a |
| 726 // separate SSRC there can be either one or two. | 721 // separate SSRC there can be either one or two. |
| 727 auto it = video_receive_ssrcs_.begin(); | 722 video_rtp_demuxer_.RemoveSink(receive_stream_impl); |
| 728 while (it != video_receive_ssrcs_.end()) { | 723 receive_rtp_config_.erase(config.rtp.remote_ssrc); |
| 729 if (it->second == static_cast<VideoReceiveStream*>(receive_stream)) { | 724 if (config.rtp.rtx_ssrc) { |
| 730 if (receive_stream_impl != nullptr) | 725 receive_rtp_config_.erase(config.rtp.rtx_ssrc); |
| 731 RTC_DCHECK(receive_stream_impl == it->second); | |
| 732 receive_stream_impl = it->second; | |
| 733 receive_rtp_config_.erase(it->first); | |
| 734 it = video_receive_ssrcs_.erase(it); | |
| 735 } else { | |
| 736 ++it; | |
| 737 } | |
| 738 } | 726 } |
| 739 video_receive_streams_.erase(receive_stream_impl); | 727 video_receive_streams_.erase(receive_stream_impl); |
| 740 RTC_CHECK(receive_stream_impl != nullptr); | 728 ConfigureSync(config.sync_group); |
| 741 ConfigureSync(receive_stream_impl->config().sync_group); | |
| 742 } | 729 } |
| 743 const VideoReceiveStream::Config& config = receive_stream_impl->config(); | |
| 744 | 730 |
| 745 receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(config)) | 731 receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(config)) |
| 746 ->RemoveStream(config.rtp.remote_ssrc); | 732 ->RemoveStream(config.rtp.remote_ssrc); |
| 747 | 733 |
| 748 UpdateAggregateNetworkState(); | 734 UpdateAggregateNetworkState(); |
| 749 delete receive_stream_impl; | 735 delete receive_stream_impl; |
| 750 } | 736 } |
| 751 | 737 |
| 752 FlexfecReceiveStream* Call::CreateFlexfecReceiveStream( | 738 FlexfecReceiveStream* Call::CreateFlexfecReceiveStream( |
| 753 const FlexfecReceiveStream::Config& config) { | 739 const FlexfecReceiveStream::Config& config) { |
| 754 TRACE_EVENT0("webrtc", "Call::CreateFlexfecReceiveStream"); | 740 TRACE_EVENT0("webrtc", "Call::CreateFlexfecReceiveStream"); |
| 755 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 741 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
| 756 | 742 |
| 757 RecoveredPacketReceiver* recovered_packet_receiver = this; | 743 RecoveredPacketReceiver* recovered_packet_receiver = this; |
| 758 FlexfecReceiveStreamImpl* receive_stream = new FlexfecReceiveStreamImpl( | 744 FlexfecReceiveStreamImpl* receive_stream = new FlexfecReceiveStreamImpl( |
| 759 config, recovered_packet_receiver, call_stats_->rtcp_rtt_stats(), | 745 config, recovered_packet_receiver, call_stats_->rtcp_rtt_stats(), |
| 760 module_process_thread_.get()); | 746 module_process_thread_.get()); |
| 761 | 747 |
| 762 { | 748 { |
| 763 WriteLockScoped write_lock(*receive_crit_); | 749 WriteLockScoped write_lock(*receive_crit_); |
| 764 | 750 video_rtp_demuxer_.AddSink(config.remote_ssrc, receive_stream); |
| 765 RTC_DCHECK(flexfec_receive_streams_.find(receive_stream) == | |
| 766 flexfec_receive_streams_.end()); | |
| 767 flexfec_receive_streams_.insert(receive_stream); | |
| 768 | 751 |
| 769 for (auto ssrc : config.protected_media_ssrcs) | 752 for (auto ssrc : config.protected_media_ssrcs) |
| 770 flexfec_receive_ssrcs_media_.insert(std::make_pair(ssrc, receive_stream)); | 753 video_rtp_demuxer_.AddSink(ssrc, receive_stream); |
| 771 | |
| 772 RTC_DCHECK(flexfec_receive_ssrcs_protection_.find(config.remote_ssrc) == | |
| 773 flexfec_receive_ssrcs_protection_.end()); | |
| 774 flexfec_receive_ssrcs_protection_[config.remote_ssrc] = receive_stream; | |
| 775 | 754 |
| 776 RTC_DCHECK(receive_rtp_config_.find(config.remote_ssrc) == | 755 RTC_DCHECK(receive_rtp_config_.find(config.remote_ssrc) == |
| 777 receive_rtp_config_.end()); | 756 receive_rtp_config_.end()); |
| 778 receive_rtp_config_[config.remote_ssrc] = | 757 receive_rtp_config_[config.remote_ssrc] = |
| 779 ReceiveRtpConfig(config.rtp_header_extensions, UseSendSideBwe(config)); | 758 ReceiveRtpConfig(config.rtp_header_extensions, UseSendSideBwe(config)); |
| 780 } | 759 } |
| 781 | 760 |
| 782 // TODO(brandtr): Store config in RtcEventLog here. | 761 // TODO(brandtr): Store config in RtcEventLog here. |
| 783 | 762 |
| 784 return receive_stream; | 763 return receive_stream; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 796 { | 775 { |
| 797 WriteLockScoped write_lock(*receive_crit_); | 776 WriteLockScoped write_lock(*receive_crit_); |
| 798 | 777 |
| 799 const FlexfecReceiveStream::Config& config = | 778 const FlexfecReceiveStream::Config& config = |
| 800 receive_stream_impl->GetConfig(); | 779 receive_stream_impl->GetConfig(); |
| 801 uint32_t ssrc = config.remote_ssrc; | 780 uint32_t ssrc = config.remote_ssrc; |
| 802 receive_rtp_config_.erase(ssrc); | 781 receive_rtp_config_.erase(ssrc); |
| 803 | 782 |
| 804 // Remove all SSRCs pointing to the FlexfecReceiveStreamImpl to be | 783 // Remove all SSRCs pointing to the FlexfecReceiveStreamImpl to be |
| 805 // destroyed. | 784 // destroyed. |
| 806 auto prot_it = flexfec_receive_ssrcs_protection_.begin(); | 785 video_rtp_demuxer_.RemoveSink(receive_stream_impl); |
| 807 while (prot_it != flexfec_receive_ssrcs_protection_.end()) { | |
| 808 if (prot_it->second == receive_stream_impl) | |
| 809 prot_it = flexfec_receive_ssrcs_protection_.erase(prot_it); | |
| 810 else | |
| 811 ++prot_it; | |
| 812 } | |
| 813 auto media_it = flexfec_receive_ssrcs_media_.begin(); | |
| 814 while (media_it != flexfec_receive_ssrcs_media_.end()) { | |
| 815 if (media_it->second == receive_stream_impl) | |
| 816 media_it = flexfec_receive_ssrcs_media_.erase(media_it); | |
| 817 else | |
| 818 ++media_it; | |
| 819 } | |
| 820 | |
| 821 receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(config)) | 786 receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(config)) |
| 822 ->RemoveStream(ssrc); | 787 ->RemoveStream(ssrc); |
| 823 | |
| 824 flexfec_receive_streams_.erase(receive_stream_impl); | |
| 825 } | 788 } |
| 826 | 789 |
| 827 delete receive_stream_impl; | 790 delete receive_stream_impl; |
| 828 } | 791 } |
| 829 | 792 |
| 830 Call::Stats Call::GetStats() const { | 793 Call::Stats Call::GetStats() const { |
| 831 // TODO(solenberg): Some test cases in EndToEndTest use this from a different | 794 // TODO(solenberg): Some test cases in EndToEndTest use this from a different |
| 832 // thread. Re-enable once that is fixed. | 795 // thread. Re-enable once that is fixed. |
| 833 // RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 796 // RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
| 834 Stats stats; | 797 Stats stats; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 901 ReadLockScoped read_lock(*send_crit_); | 864 ReadLockScoped read_lock(*send_crit_); |
| 902 for (auto& kv : audio_send_ssrcs_) { | 865 for (auto& kv : audio_send_ssrcs_) { |
| 903 kv.second->SignalNetworkState(audio_network_state_); | 866 kv.second->SignalNetworkState(audio_network_state_); |
| 904 } | 867 } |
| 905 for (auto& kv : video_send_ssrcs_) { | 868 for (auto& kv : video_send_ssrcs_) { |
| 906 kv.second->SignalNetworkState(video_network_state_); | 869 kv.second->SignalNetworkState(video_network_state_); |
| 907 } | 870 } |
| 908 } | 871 } |
| 909 { | 872 { |
| 910 ReadLockScoped read_lock(*receive_crit_); | 873 ReadLockScoped read_lock(*receive_crit_); |
| 911 for (auto& kv : audio_receive_ssrcs_) { | 874 for (AudioReceiveStream* audio_receive_stream : audio_receive_streams_) { |
| 912 kv.second->SignalNetworkState(audio_network_state_); | 875 audio_receive_stream->SignalNetworkState(audio_network_state_); |
| 913 } | 876 } |
| 914 for (auto& kv : video_receive_ssrcs_) { | 877 for (VideoReceiveStream* video_receive_stream : video_receive_streams_) { |
| 915 kv.second->SignalNetworkState(video_network_state_); | 878 video_receive_stream->SignalNetworkState(video_network_state_); |
| 916 } | 879 } |
| 917 } | 880 } |
| 918 } | 881 } |
| 919 | 882 |
| 920 void Call::OnTransportOverheadChanged(MediaType media, | 883 void Call::OnTransportOverheadChanged(MediaType media, |
| 921 int transport_overhead_per_packet) { | 884 int transport_overhead_per_packet) { |
| 922 switch (media) { | 885 switch (media) { |
| 923 case MediaType::AUDIO: { | 886 case MediaType::AUDIO: { |
| 924 ReadLockScoped read_lock(*send_crit_); | 887 ReadLockScoped read_lock(*send_crit_); |
| 925 for (auto& kv : audio_send_ssrcs_) { | 888 for (auto& kv : audio_send_ssrcs_) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 987 bool have_video = false; | 950 bool have_video = false; |
| 988 { | 951 { |
| 989 ReadLockScoped read_lock(*send_crit_); | 952 ReadLockScoped read_lock(*send_crit_); |
| 990 if (audio_send_ssrcs_.size() > 0) | 953 if (audio_send_ssrcs_.size() > 0) |
| 991 have_audio = true; | 954 have_audio = true; |
| 992 if (video_send_ssrcs_.size() > 0) | 955 if (video_send_ssrcs_.size() > 0) |
| 993 have_video = true; | 956 have_video = true; |
| 994 } | 957 } |
| 995 { | 958 { |
| 996 ReadLockScoped read_lock(*receive_crit_); | 959 ReadLockScoped read_lock(*receive_crit_); |
| 997 if (audio_receive_ssrcs_.size() > 0) | 960 if (audio_receive_streams_.size() > 0) |
| 998 have_audio = true; | 961 have_audio = true; |
| 999 if (video_receive_ssrcs_.size() > 0) | 962 if (video_receive_streams_.size() > 0) |
| 1000 have_video = true; | 963 have_video = true; |
| 1001 } | 964 } |
| 1002 | 965 |
| 1003 NetworkState aggregate_state = kNetworkDown; | 966 NetworkState aggregate_state = kNetworkDown; |
| 1004 if ((have_video && video_network_state_ == kNetworkUp) || | 967 if ((have_video && video_network_state_ == kNetworkUp) || |
| 1005 (have_audio && audio_network_state_ == kNetworkUp)) { | 968 (have_audio && audio_network_state_ == kNetworkUp)) { |
| 1006 aggregate_state = kNetworkUp; | 969 aggregate_state = kNetworkUp; |
| 1007 } | 970 } |
| 1008 | 971 |
| 1009 LOG(LS_INFO) << "UpdateAggregateNetworkState: aggregate_state=" | 972 LOG(LS_INFO) << "UpdateAggregateNetworkState: aggregate_state=" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1080 if (sync_group.empty()) | 1043 if (sync_group.empty()) |
| 1081 return; | 1044 return; |
| 1082 | 1045 |
| 1083 AudioReceiveStream* sync_audio_stream = nullptr; | 1046 AudioReceiveStream* sync_audio_stream = nullptr; |
| 1084 // Find existing audio stream. | 1047 // Find existing audio stream. |
| 1085 const auto it = sync_stream_mapping_.find(sync_group); | 1048 const auto it = sync_stream_mapping_.find(sync_group); |
| 1086 if (it != sync_stream_mapping_.end()) { | 1049 if (it != sync_stream_mapping_.end()) { |
| 1087 sync_audio_stream = it->second; | 1050 sync_audio_stream = it->second; |
| 1088 } else { | 1051 } else { |
| 1089 // No configured audio stream, see if we can find one. | 1052 // No configured audio stream, see if we can find one. |
| 1090 for (const auto& kv : audio_receive_ssrcs_) { | 1053 for (AudioReceiveStream* stream : audio_receive_streams_) { |
| 1091 if (kv.second->config().sync_group == sync_group) { | 1054 if (stream->config().sync_group == sync_group) { |
| 1092 if (sync_audio_stream != nullptr) { | 1055 if (sync_audio_stream != nullptr) { |
| 1093 LOG(LS_WARNING) << "Attempting to sync more than one audio stream " | 1056 LOG(LS_WARNING) << "Attempting to sync more than one audio stream " |
| 1094 "within the same sync group. This is not " | 1057 "within the same sync group. This is not " |
| 1095 "supported in the current implementation."; | 1058 "supported in the current implementation."; |
| 1096 break; | 1059 break; |
| 1097 } | 1060 } |
| 1098 sync_audio_stream = kv.second; | 1061 sync_audio_stream = stream; |
| 1099 } | 1062 } |
| 1100 } | 1063 } |
| 1101 } | 1064 } |
| 1102 if (sync_audio_stream) | 1065 if (sync_audio_stream) |
| 1103 sync_stream_mapping_[sync_group] = sync_audio_stream; | 1066 sync_stream_mapping_[sync_group] = sync_audio_stream; |
| 1104 size_t num_synced_streams = 0; | 1067 size_t num_synced_streams = 0; |
| 1105 for (VideoReceiveStream* video_stream : video_receive_streams_) { | 1068 for (VideoReceiveStream* video_stream : video_receive_streams_) { |
| 1106 if (video_stream->config().sync_group != sync_group) | 1069 if (video_stream->config().sync_group != sync_group) |
| 1107 continue; | 1070 continue; |
| 1108 ++num_synced_streams; | 1071 ++num_synced_streams; |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 1138 bool rtcp_delivered = false; | 1101 bool rtcp_delivered = false; |
| 1139 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) { | 1102 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) { |
| 1140 ReadLockScoped read_lock(*receive_crit_); | 1103 ReadLockScoped read_lock(*receive_crit_); |
| 1141 for (VideoReceiveStream* stream : video_receive_streams_) { | 1104 for (VideoReceiveStream* stream : video_receive_streams_) { |
| 1142 if (stream->DeliverRtcp(packet, length)) | 1105 if (stream->DeliverRtcp(packet, length)) |
| 1143 rtcp_delivered = true; | 1106 rtcp_delivered = true; |
| 1144 } | 1107 } |
| 1145 } | 1108 } |
| 1146 if (media_type == MediaType::ANY || media_type == MediaType::AUDIO) { | 1109 if (media_type == MediaType::ANY || media_type == MediaType::AUDIO) { |
| 1147 ReadLockScoped read_lock(*receive_crit_); | 1110 ReadLockScoped read_lock(*receive_crit_); |
| 1148 for (auto& kv : audio_receive_ssrcs_) { | 1111 for (AudioReceiveStream* stream : audio_receive_streams_) { |
| 1149 if (kv.second->DeliverRtcp(packet, length)) | 1112 if (stream->DeliverRtcp(packet, length)) |
| 1150 rtcp_delivered = true; | 1113 rtcp_delivered = true; |
| 1151 } | 1114 } |
| 1152 } | 1115 } |
| 1153 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) { | 1116 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) { |
| 1154 ReadLockScoped read_lock(*send_crit_); | 1117 ReadLockScoped read_lock(*send_crit_); |
| 1155 for (VideoSendStream* stream : video_send_streams_) { | 1118 for (VideoSendStream* stream : video_send_streams_) { |
| 1156 if (stream->DeliverRtcp(packet, length)) | 1119 if (stream->DeliverRtcp(packet, length)) |
| 1157 rtcp_delivered = true; | 1120 rtcp_delivered = true; |
| 1158 } | 1121 } |
| 1159 } | 1122 } |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 1183 // TODO(nisse): We should parse the RTP header only here, and pass | 1146 // TODO(nisse): We should parse the RTP header only here, and pass |
| 1184 // on parsed_packet to the receive streams. | 1147 // on parsed_packet to the receive streams. |
| 1185 rtc::Optional<RtpPacketReceived> parsed_packet = | 1148 rtc::Optional<RtpPacketReceived> parsed_packet = |
| 1186 ParseRtpPacket(packet, length, packet_time); | 1149 ParseRtpPacket(packet, length, packet_time); |
| 1187 | 1150 |
| 1188 if (!parsed_packet) | 1151 if (!parsed_packet) |
| 1189 return DELIVERY_PACKET_ERROR; | 1152 return DELIVERY_PACKET_ERROR; |
| 1190 | 1153 |
| 1191 NotifyBweOfReceivedPacket(*parsed_packet, media_type); | 1154 NotifyBweOfReceivedPacket(*parsed_packet, media_type); |
| 1192 | 1155 |
| 1193 uint32_t ssrc = parsed_packet->Ssrc(); | |
| 1194 | |
| 1195 if (media_type == MediaType::AUDIO) { | 1156 if (media_type == MediaType::AUDIO) { |
| 1196 auto it = audio_receive_ssrcs_.find(ssrc); | 1157 if (audio_rtp_demuxer_.OnRtpPacket(*parsed_packet)) { |
| 1197 if (it != audio_receive_ssrcs_.end()) { | |
| 1198 received_bytes_per_second_counter_.Add(static_cast<int>(length)); | 1158 received_bytes_per_second_counter_.Add(static_cast<int>(length)); |
| 1199 received_audio_bytes_per_second_counter_.Add(static_cast<int>(length)); | 1159 received_audio_bytes_per_second_counter_.Add(static_cast<int>(length)); |
| 1200 it->second->OnRtpPacket(*parsed_packet); | |
| 1201 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length); | 1160 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length); |
| 1202 return DELIVERY_OK; | 1161 return DELIVERY_OK; |
| 1203 } | 1162 } |
| 1204 } | 1163 } else if (media_type == MediaType::VIDEO) { |
| 1205 if (media_type == MediaType::VIDEO) { | 1164 if (video_rtp_demuxer_.OnRtpPacket(*parsed_packet)) { |
| 1206 auto it = video_receive_ssrcs_.find(ssrc); | |
| 1207 if (it != video_receive_ssrcs_.end()) { | |
| 1208 received_bytes_per_second_counter_.Add(static_cast<int>(length)); | 1165 received_bytes_per_second_counter_.Add(static_cast<int>(length)); |
| 1209 received_video_bytes_per_second_counter_.Add(static_cast<int>(length)); | 1166 received_video_bytes_per_second_counter_.Add(static_cast<int>(length)); |
| 1210 it->second->OnRtpPacket(*parsed_packet); | |
| 1211 | |
| 1212 // Deliver media packets to FlexFEC subsystem. | |
| 1213 auto it_bounds = flexfec_receive_ssrcs_media_.equal_range(ssrc); | |
| 1214 for (auto it = it_bounds.first; it != it_bounds.second; ++it) | |
| 1215 it->second->OnRtpPacket(*parsed_packet); | |
| 1216 | |
| 1217 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length); | 1167 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length); |
| 1218 return DELIVERY_OK; | 1168 return DELIVERY_OK; |
| 1219 } | 1169 } |
| 1220 } | |
| 1221 if (media_type == MediaType::VIDEO) { | |
| 1222 received_bytes_per_second_counter_.Add(static_cast<int>(length)); | |
| 1223 // TODO(brandtr): Update here when FlexFEC supports protecting audio. | |
| 1224 received_video_bytes_per_second_counter_.Add(static_cast<int>(length)); | |
| 1225 auto it = flexfec_receive_ssrcs_protection_.find(ssrc); | |
| 1226 if (it != flexfec_receive_ssrcs_protection_.end()) { | |
| 1227 it->second->OnRtpPacket(*parsed_packet); | |
| 1228 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length); | |
| 1229 return DELIVERY_OK; | |
| 1230 } | |
| 1231 } | 1170 } |
| 1232 return DELIVERY_UNKNOWN_SSRC; | 1171 return DELIVERY_UNKNOWN_SSRC; |
| 1233 } | 1172 } |
| 1234 | 1173 |
| 1235 PacketReceiver::DeliveryStatus Call::DeliverPacket( | 1174 PacketReceiver::DeliveryStatus Call::DeliverPacket( |
| 1236 MediaType media_type, | 1175 MediaType media_type, |
| 1237 const uint8_t* packet, | 1176 const uint8_t* packet, |
| 1238 size_t length, | 1177 size_t length, |
| 1239 const PacketTime& packet_time) { | 1178 const PacketTime& packet_time) { |
| 1240 // TODO(solenberg): Tests call this function on a network thread, libjingle | 1179 // TODO(solenberg): Tests call this function on a network thread, libjingle |
| 1241 // calls on the worker thread. We should move towards always using a network | 1180 // calls on the worker thread. We should move towards always using a network |
| 1242 // thread. Then this check can be enabled. | 1181 // thread. Then this check can be enabled. |
| 1243 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); | 1182 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); |
| 1244 if (RtpHeaderParser::IsRtcp(packet, length)) | 1183 if (RtpHeaderParser::IsRtcp(packet, length)) |
| 1245 return DeliverRtcp(media_type, packet, length); | 1184 return DeliverRtcp(media_type, packet, length); |
| 1246 | 1185 |
| 1247 return DeliverRtp(media_type, packet, length, packet_time); | 1186 return DeliverRtp(media_type, packet, length, packet_time); |
| 1248 } | 1187 } |
| 1249 | 1188 |
| 1250 // TODO(brandtr): Update this member function when we support protecting | 1189 // TODO(brandtr): Update this member function when we support protecting |
| 1251 // audio packets with FlexFEC. | 1190 // audio packets with FlexFEC. |
| 1252 bool Call::OnRecoveredPacket(const uint8_t* packet, size_t length) { | 1191 bool Call::OnRecoveredPacket(const uint8_t* packet, size_t length) { |
| 1192 #if 0 | |
| 1253 uint32_t ssrc = ByteReader<uint32_t>::ReadBigEndian(&packet[8]); | 1193 uint32_t ssrc = ByteReader<uint32_t>::ReadBigEndian(&packet[8]); |
| 1254 ReadLockScoped read_lock(*receive_crit_); | 1194 ReadLockScoped read_lock(*receive_crit_); |
| 1255 auto it = video_receive_ssrcs_.find(ssrc); | 1195 auto it = video_receive_ssrcs_.find(ssrc); |
| 1256 if (it == video_receive_ssrcs_.end()) | 1196 if (it == video_receive_ssrcs_.end()) |
| 1257 return false; | 1197 return false; |
| 1258 return it->second->OnRecoveredPacket(packet, length); | 1198 return it->second->OnRecoveredPacket(packet, length); |
| 1199 #else | |
| 1200 // TODO(nisse): How should we handle this? It might make sense to | |
| 1201 // parse packets here, add a "recovered" flag to RtpPacketReceived, | |
|
danilchap
2017/05/09 09:20:22
looks reasonable,
may instead of adding flag 'reco
nisse-webrtc
2017/05/09 12:11:48
Sounds good to me, unless there's some reason to t
danilchap
2017/05/09 13:23:41
just a side comment, free to ignore it:
If this fl
| |
| 1202 // and then just pass it on to video_rtp_demuxer_.OnRtpPacket? | |
| 1203 return false; | |
| 1204 #endif | |
| 1259 } | 1205 } |
| 1260 | 1206 |
| 1261 void Call::NotifyBweOfReceivedPacket(const RtpPacketReceived& packet, | 1207 void Call::NotifyBweOfReceivedPacket(const RtpPacketReceived& packet, |
| 1262 MediaType media_type) { | 1208 MediaType media_type) { |
| 1263 auto it = receive_rtp_config_.find(packet.Ssrc()); | 1209 auto it = receive_rtp_config_.find(packet.Ssrc()); |
| 1264 bool use_send_side_bwe = | 1210 bool use_send_side_bwe = |
| 1265 (it != receive_rtp_config_.end()) && it->second.use_send_side_bwe; | 1211 (it != receive_rtp_config_.end()) && it->second.use_send_side_bwe; |
| 1266 | 1212 |
| 1267 RTPHeader header; | 1213 RTPHeader header; |
| 1268 packet.GetHeader(&header); | 1214 packet.GetHeader(&header); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 1282 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { | 1228 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { |
| 1283 receive_side_cc_.OnReceivedPacket( | 1229 receive_side_cc_.OnReceivedPacket( |
| 1284 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), | 1230 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), |
| 1285 header); | 1231 header); |
| 1286 } | 1232 } |
| 1287 } | 1233 } |
| 1288 | 1234 |
| 1289 } // namespace internal | 1235 } // namespace internal |
| 1290 | 1236 |
| 1291 } // namespace webrtc | 1237 } // namespace webrtc |
| OLD | NEW |