| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 GUARDED_BY(receive_crit_); | 116 GUARDED_BY(receive_crit_); |
| 117 | 117 |
| 118 rtc::scoped_ptr<RWLockWrapper> send_crit_; | 118 rtc::scoped_ptr<RWLockWrapper> send_crit_; |
| 119 // Audio and Video send streams are owned by the client that creates them. | 119 // Audio and Video send streams are owned by the client that creates them. |
| 120 std::map<uint32_t, AudioSendStream*> audio_send_ssrcs_ GUARDED_BY(send_crit_); | 120 std::map<uint32_t, AudioSendStream*> audio_send_ssrcs_ GUARDED_BY(send_crit_); |
| 121 std::map<uint32_t, VideoSendStream*> video_send_ssrcs_ GUARDED_BY(send_crit_); | 121 std::map<uint32_t, VideoSendStream*> video_send_ssrcs_ GUARDED_BY(send_crit_); |
| 122 std::set<VideoSendStream*> video_send_streams_ GUARDED_BY(send_crit_); | 122 std::set<VideoSendStream*> video_send_streams_ GUARDED_BY(send_crit_); |
| 123 | 123 |
| 124 VideoSendStream::RtpStateMap suspended_video_send_ssrcs_; | 124 VideoSendStream::RtpStateMap suspended_video_send_ssrcs_; |
| 125 | 125 |
| 126 RtcEventLog* event_log_ = nullptr; | 126 RtcEventLog* event_log_; |
| 127 VoECodec* voe_codec_ = nullptr; | |
| 128 | 127 |
| 129 RTC_DISALLOW_COPY_AND_ASSIGN(Call); | 128 RTC_DISALLOW_COPY_AND_ASSIGN(Call); |
| 130 }; | 129 }; |
| 131 } // namespace internal | 130 } // namespace internal |
| 132 | 131 |
| 133 Call* Call::Create(const Call::Config& config) { | 132 Call* Call::Create(const Call::Config& config) { |
| 134 return new internal::Call(config); | 133 return new internal::Call(config); |
| 135 } | 134 } |
| 136 | 135 |
| 137 namespace internal { | 136 namespace internal { |
| 138 | 137 |
| 139 Call::Call(const Call::Config& config) | 138 Call::Call(const Call::Config& config) |
| 140 : num_cpu_cores_(CpuInfo::DetectNumberOfCores()), | 139 : num_cpu_cores_(CpuInfo::DetectNumberOfCores()), |
| 141 module_process_thread_(ProcessThread::Create("ModuleProcessThread")), | 140 module_process_thread_(ProcessThread::Create("ModuleProcessThread")), |
| 142 channel_group_(new ChannelGroup(module_process_thread_.get())), | 141 channel_group_(new ChannelGroup(module_process_thread_.get())), |
| 143 config_(config), | 142 config_(config), |
| 144 network_enabled_(true), | 143 network_enabled_(true), |
| 145 receive_crit_(RWLockWrapper::CreateRWLock()), | 144 receive_crit_(RWLockWrapper::CreateRWLock()), |
| 146 send_crit_(RWLockWrapper::CreateRWLock()) { | 145 send_crit_(RWLockWrapper::CreateRWLock()), |
| 146 event_log_(nullptr) { |
| 147 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 147 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
| 148 RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0); | 148 RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0); |
| 149 RTC_DCHECK_GE(config.bitrate_config.start_bitrate_bps, | 149 RTC_DCHECK_GE(config.bitrate_config.start_bitrate_bps, |
| 150 config.bitrate_config.min_bitrate_bps); | 150 config.bitrate_config.min_bitrate_bps); |
| 151 if (config.bitrate_config.max_bitrate_bps != -1) { | 151 if (config.bitrate_config.max_bitrate_bps != -1) { |
| 152 RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps, | 152 RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps, |
| 153 config.bitrate_config.start_bitrate_bps); | 153 config.bitrate_config.start_bitrate_bps); |
| 154 } | 154 } |
| 155 if (config.voice_engine) { | 155 if (config.voice_engine) { |
| 156 // Keep a reference to VoECodec, so we're sure the VoiceEngine lives for the | 156 VoECodec* voe_codec = VoECodec::GetInterface(config.voice_engine); |
| 157 // duration of the call. | 157 if (voe_codec) { |
| 158 voe_codec_ = VoECodec::GetInterface(config.voice_engine); | 158 event_log_ = voe_codec->GetEventLog(); |
| 159 if (voe_codec_) | 159 voe_codec->Release(); |
| 160 event_log_ = voe_codec_->GetEventLog(); | 160 } |
| 161 } | 161 } |
| 162 | 162 |
| 163 Trace::CreateTrace(); | 163 Trace::CreateTrace(); |
| 164 module_process_thread_->Start(); | 164 module_process_thread_->Start(); |
| 165 | 165 |
| 166 channel_group_->SetBweBitrates(config_.bitrate_config.min_bitrate_bps, | 166 channel_group_->SetBweBitrates(config_.bitrate_config.min_bitrate_bps, |
| 167 config_.bitrate_config.start_bitrate_bps, | 167 config_.bitrate_config.start_bitrate_bps, |
| 168 config_.bitrate_config.max_bitrate_bps); | 168 config_.bitrate_config.max_bitrate_bps); |
| 169 } | 169 } |
| 170 | 170 |
| 171 Call::~Call() { | 171 Call::~Call() { |
| 172 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 172 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
| 173 RTC_CHECK(audio_send_ssrcs_.empty()); | 173 RTC_CHECK(audio_send_ssrcs_.empty()); |
| 174 RTC_CHECK(video_send_ssrcs_.empty()); | 174 RTC_CHECK(video_send_ssrcs_.empty()); |
| 175 RTC_CHECK(video_send_streams_.empty()); | 175 RTC_CHECK(video_send_streams_.empty()); |
| 176 RTC_CHECK(audio_receive_ssrcs_.empty()); | 176 RTC_CHECK(audio_receive_ssrcs_.empty()); |
| 177 RTC_CHECK(video_receive_ssrcs_.empty()); | 177 RTC_CHECK(video_receive_ssrcs_.empty()); |
| 178 RTC_CHECK(video_receive_streams_.empty()); | 178 RTC_CHECK(video_receive_streams_.empty()); |
| 179 | 179 |
| 180 module_process_thread_->Stop(); | 180 module_process_thread_->Stop(); |
| 181 Trace::ReturnTrace(); | 181 Trace::ReturnTrace(); |
| 182 | |
| 183 if (voe_codec_) | |
| 184 voe_codec_->Release(); | |
| 185 } | 182 } |
| 186 | 183 |
| 187 PacketReceiver* Call::Receiver() { | 184 PacketReceiver* Call::Receiver() { |
| 188 // TODO(solenberg): Some test cases in EndToEndTest use this from a different | 185 // TODO(solenberg): Some test cases in EndToEndTest use this from a different |
| 189 // thread. Re-enable once that is fixed. | 186 // thread. Re-enable once that is fixed. |
| 190 // RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 187 // RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
| 191 return this; | 188 return this; |
| 192 } | 189 } |
| 193 | 190 |
| 194 webrtc::AudioSendStream* Call::CreateAudioSendStream( | 191 webrtc::AudioSendStream* Call::CreateAudioSendStream( |
| (...skipping 30 matching lines...) Expand all Loading... |
| 225 RTC_DCHECK(num_deleted == 1); | 222 RTC_DCHECK(num_deleted == 1); |
| 226 } | 223 } |
| 227 delete audio_send_stream; | 224 delete audio_send_stream; |
| 228 } | 225 } |
| 229 | 226 |
| 230 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( | 227 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( |
| 231 const webrtc::AudioReceiveStream::Config& config) { | 228 const webrtc::AudioReceiveStream::Config& config) { |
| 232 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); | 229 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); |
| 233 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 230 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
| 234 AudioReceiveStream* receive_stream = new AudioReceiveStream( | 231 AudioReceiveStream* receive_stream = new AudioReceiveStream( |
| 235 channel_group_->GetRemoteBitrateEstimator(false), config, | 232 channel_group_->GetRemoteBitrateEstimator(false), config); |
| 236 config_.voice_engine); | |
| 237 { | 233 { |
| 238 WriteLockScoped write_lock(*receive_crit_); | 234 WriteLockScoped write_lock(*receive_crit_); |
| 239 RTC_DCHECK(audio_receive_ssrcs_.find(config.rtp.remote_ssrc) == | 235 RTC_DCHECK(audio_receive_ssrcs_.find(config.rtp.remote_ssrc) == |
| 240 audio_receive_ssrcs_.end()); | 236 audio_receive_ssrcs_.end()); |
| 241 audio_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream; | 237 audio_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream; |
| 242 ConfigureSync(config.sync_group); | 238 ConfigureSync(config.sync_group); |
| 243 } | 239 } |
| 244 return receive_stream; | 240 return receive_stream; |
| 245 } | 241 } |
| 246 | 242 |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 // thread. Then this check can be enabled. | 592 // thread. Then this check can be enabled. |
| 597 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); | 593 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); |
| 598 if (RtpHeaderParser::IsRtcp(packet, length)) | 594 if (RtpHeaderParser::IsRtcp(packet, length)) |
| 599 return DeliverRtcp(media_type, packet, length); | 595 return DeliverRtcp(media_type, packet, length); |
| 600 | 596 |
| 601 return DeliverRtp(media_type, packet, length, packet_time); | 597 return DeliverRtp(media_type, packet, length, packet_time); |
| 602 } | 598 } |
| 603 | 599 |
| 604 } // namespace internal | 600 } // namespace internal |
| 605 } // namespace webrtc | 601 } // namespace webrtc |
| OLD | NEW |