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

Unified Diff: webrtc/call/call.cc

Issue 1409193003: Remove network_enabled_crit_ in call.cc. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: pbos review Created 5 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/call/call.cc
diff --git a/webrtc/call/call.cc b/webrtc/call/call.cc
index b1424531d6060a11d4812b20b74950e681b781b1..4848bf41a68075a22919a9ebdd0b21a53141e010 100644
--- a/webrtc/call/call.cc
+++ b/webrtc/call/call.cc
@@ -101,11 +101,7 @@ class Call : public webrtc::Call, public PacketReceiver {
Call::Config config_;
rtc::ThreadChecker configuration_thread_checker_;
- // Needs to be held while write-locking |receive_crit_| or |send_crit_|. This
- // ensures that we have a consistent network state signalled to all senders
- // and receivers.
- rtc::CriticalSection network_enabled_crit_;
- bool network_enabled_ GUARDED_BY(network_enabled_crit_);
+ bool network_enabled_;
rtc::scoped_ptr<RWLockWrapper> receive_crit_;
// Audio and Video receive streams are owned by the client that creates them.
@@ -201,15 +197,13 @@ webrtc::AudioSendStream* Call::CreateAudioSendStream(
TRACE_EVENT0("webrtc", "Call::CreateAudioSendStream");
RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
AudioSendStream* send_stream = new AudioSendStream(config);
+ if (!network_enabled_)
+ send_stream->SignalNetworkState(kNetworkDown);
{
- rtc::CritScope lock(&network_enabled_crit_);
WriteLockScoped write_lock(*send_crit_);
RTC_DCHECK(audio_send_ssrcs_.find(config.rtp.ssrc) ==
audio_send_ssrcs_.end());
audio_send_ssrcs_[config.rtp.ssrc] = send_stream;
-
- if (!network_enabled_)
- send_stream->SignalNetworkState(kNetworkDown);
}
return send_stream;
}
@@ -284,9 +278,9 @@ webrtc::VideoSendStream* Call::CreateVideoSendStream(
congestion_controller_.get(), config, encoder_config,
suspended_video_send_ssrcs_);
- // This needs to be taken before send_crit_ as both locks need to be held
- // while changing network state.
- rtc::CritScope lock(&network_enabled_crit_);
+ if (!network_enabled_)
+ send_stream->SignalNetworkState(kNetworkDown);
+
WriteLockScoped write_lock(*send_crit_);
for (uint32_t ssrc : config.rtp.ssrcs) {
RTC_DCHECK(video_send_ssrcs_.find(ssrc) == video_send_ssrcs_.end());
@@ -297,8 +291,6 @@ webrtc::VideoSendStream* Call::CreateVideoSendStream(
if (event_log_)
event_log_->LogVideoSendStreamConfig(config);
- if (!network_enabled_)
- send_stream->SignalNetworkState(kNetworkDown);
return send_stream;
}
@@ -344,9 +336,6 @@ webrtc::VideoReceiveStream* Call::CreateVideoReceiveStream(
num_cpu_cores_, congestion_controller_.get(), config,
config_.voice_engine, module_process_thread_.get(), call_stats_.get());
- // This needs to be taken before receive_crit_ as both locks need to be held
- // while changing network state.
- rtc::CritScope lock(&network_enabled_crit_);
WriteLockScoped write_lock(*receive_crit_);
RTC_DCHECK(video_receive_ssrcs_.find(config.rtp.remote_ssrc) ==
video_receive_ssrcs_.end());
@@ -450,9 +439,6 @@ void Call::SetBitrateConfig(
void Call::SignalNetworkState(NetworkState state) {
RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
- // Take crit for entire function, it needs to be held while updating streams
- // to guarantee a consistent state across streams.
- rtc::CritScope lock(&network_enabled_crit_);
network_enabled_ = state == kNetworkUp;
congestion_controller_->SignalNetworkState(state);
{
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698