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

Unified Diff: webrtc/modules/audio_coding/codecs/isac/main/source/audio_encoder_isac.cc

Issue 1176303004: Fix a data race in AudioEncoderMutableImpl and derived classes (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Return config_ by value instead of reference Created 5 years, 6 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
Index: webrtc/modules/audio_coding/codecs/isac/main/source/audio_encoder_isac.cc
diff --git a/webrtc/modules/audio_coding/codecs/isac/main/source/audio_encoder_isac.cc b/webrtc/modules/audio_coding/codecs/isac/main/source/audio_encoder_isac.cc
index b2c1241e765d8f68c6d208075b3937d8ea1779c7..201a2d4bb43354401f56d7501833ff0364bbfb8c 100644
--- a/webrtc/modules/audio_coding/codecs/isac/main/source/audio_encoder_isac.cc
+++ b/webrtc/modules/audio_coding/codecs/isac/main/source/audio_encoder_isac.cc
@@ -65,6 +65,7 @@ int AudioEncoderDecoderMutableIsacFloat::Decode(const uint8_t* encoded,
size_t max_decoded_bytes,
int16_t* decoded,
SpeechType* speech_type) {
+ CriticalSectionScoped cs(encoder_lock_.get());
return encoder()->Decode(encoded, encoded_len, sample_rate_hz,
max_decoded_bytes, decoded, speech_type);
}
@@ -76,20 +77,24 @@ int AudioEncoderDecoderMutableIsacFloat::DecodeRedundant(
size_t max_decoded_bytes,
int16_t* decoded,
SpeechType* speech_type) {
+ CriticalSectionScoped cs(encoder_lock_.get());
return encoder()->DecodeRedundant(encoded, encoded_len, sample_rate_hz,
max_decoded_bytes, decoded, speech_type);
}
bool AudioEncoderDecoderMutableIsacFloat::HasDecodePlc() const {
+ CriticalSectionScoped cs(encoder_lock_.get());
return encoder()->HasDecodePlc();
}
int AudioEncoderDecoderMutableIsacFloat::DecodePlc(int num_frames,
int16_t* decoded) {
+ CriticalSectionScoped cs(encoder_lock_.get());
return encoder()->DecodePlc(num_frames, decoded);
}
int AudioEncoderDecoderMutableIsacFloat::Init() {
+ CriticalSectionScoped cs(encoder_lock_.get());
return encoder()->Init();
}
@@ -99,33 +104,39 @@ int AudioEncoderDecoderMutableIsacFloat::IncomingPacket(
uint16_t rtp_sequence_number,
uint32_t rtp_timestamp,
uint32_t arrival_timestamp) {
+ CriticalSectionScoped cs(encoder_lock_.get());
return encoder()->IncomingPacket(payload, payload_len, rtp_sequence_number,
rtp_timestamp, arrival_timestamp);
}
int AudioEncoderDecoderMutableIsacFloat::ErrorCode() {
+ CriticalSectionScoped cs(encoder_lock_.get());
return encoder()->ErrorCode();
}
int AudioEncoderDecoderMutableIsacFloat::PacketDuration(
const uint8_t* encoded,
size_t encoded_len) const {
+ CriticalSectionScoped cs(encoder_lock_.get());
return encoder()->PacketDuration(encoded, encoded_len);
}
int AudioEncoderDecoderMutableIsacFloat::PacketDurationRedundant(
const uint8_t* encoded,
size_t encoded_len) const {
+ CriticalSectionScoped cs(encoder_lock_.get());
return encoder()->PacketDurationRedundant(encoded, encoded_len);
}
bool AudioEncoderDecoderMutableIsacFloat::PacketHasFec(
const uint8_t* encoded,
size_t encoded_len) const {
+ CriticalSectionScoped cs(encoder_lock_.get());
return encoder()->PacketHasFec(encoded, encoded_len);
}
size_t AudioEncoderDecoderMutableIsacFloat::Channels() const {
+ CriticalSectionScoped cs(encoder_lock_.get());
return encoder()->Channels();
}

Powered by Google App Engine
This is Rietveld 408576698