Fixes a race when writing to send_padding_.

TEST=trybots
R=mflodman@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5543 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
stefan@webrtc.org 2014-02-13 13:48:38 +00:00
parent 12cb88cab9
commit ae2563ae2f

View File

@ -214,7 +214,10 @@ bool ViEEncoder::Init() {
"%s Codec failure", __FUNCTION__);
return false;
}
send_padding_ = video_codec.numberOfSimulcastStreams > 1;
{
CriticalSectionScoped cs(data_cs_.get());
send_padding_ = video_codec.numberOfSimulcastStreams > 1;
}
if (vcm_.RegisterSendCodec(&video_codec, number_of_cores_,
default_rtp_rtcp_->MaxDataPayloadLength()) != 0) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
@ -231,7 +234,10 @@ bool ViEEncoder::Init() {
#else
VideoCodec video_codec;
if (vcm_.Codec(webrtc::kVideoCodecI420, &video_codec) == VCM_OK) {
send_padding_ = video_codec.numberOfSimulcastStreams > 1;
{
CriticalSectionScoped cs(data_cs_.get());
send_padding_ = video_codec.numberOfSimulcastStreams > 1;
}
vcm_.RegisterSendCodec(&video_codec, number_of_cores_,
default_rtp_rtcp_->MaxDataPayloadLength());
default_rtp_rtcp_->RegisterSendPayload(video_codec);
@ -375,7 +381,10 @@ int32_t ViEEncoder::DeRegisterExternalEncoder(uint8_t pl_type) {
if (current_send_codec.plType == pl_type) {
uint16_t max_data_payload_length =
default_rtp_rtcp_->MaxDataPayloadLength();
send_padding_ = current_send_codec.numberOfSimulcastStreams > 1;
{
CriticalSectionScoped cs(data_cs_.get());
send_padding_ = current_send_codec.numberOfSimulcastStreams > 1;
}
if (vcm_.RegisterSendCodec(&current_send_codec, number_of_cores_,
max_data_payload_length) != VCM_OK) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,