Protect reads of ViEEncoder::video_suspended_.

Does not fix an immediate bug, since this is the only method writing to
it there are no concurrent writes, but this should be more future-proof
by protecting all accesses.

BUG=2606
R=stefan@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/4109006

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5156 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pbos@webrtc.org
2013-11-21 18:44:23 +00:00
parent 1977960866
commit 484ee962b5

View File

@@ -1112,19 +1112,19 @@ void ViEEncoder::OnNetworkChanged(const uint32_t bitrate_bps,
max_padding_bitrate_kbps,
pad_up_to_bitrate_kbps);
default_rtp_rtcp_->SetTargetSendBitrate(stream_bitrates);
if (video_is_suspended != video_suspended_) {
// State changed now. Send callback to inform about that.
{
CriticalSectionScoped cs(data_cs_.get());
if (video_suspended_ == video_is_suspended)
return;
video_suspended_ = video_is_suspended;
}
// State changed, inform codec observer.
if (codec_observer_) {
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo,
ViEId(engine_id_, channel_id_),
"%s: video_suspended_ changed to %i",
__FUNCTION__, video_suspended_);
codec_observer_->VideoSuspended(channel_id_, video_suspended_);
}
__FUNCTION__, video_is_suspended);
codec_observer_->VideoSuspended(channel_id_, video_is_suspended);
}
}