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

Side by Side Diff: webrtc/modules/audio_coding/codecs/isac/fix/source/audio_encoder_isacfix.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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 conf.max_bit_rate = max_rate_bps; 60 conf.max_bit_rate = max_rate_bps;
61 Reconstruct(conf); 61 Reconstruct(conf);
62 } 62 }
63 63
64 int AudioEncoderDecoderMutableIsacFix::Decode(const uint8_t* encoded, 64 int AudioEncoderDecoderMutableIsacFix::Decode(const uint8_t* encoded,
65 size_t encoded_len, 65 size_t encoded_len,
66 int sample_rate_hz, 66 int sample_rate_hz,
67 size_t max_decoded_bytes, 67 size_t max_decoded_bytes,
68 int16_t* decoded, 68 int16_t* decoded,
69 SpeechType* speech_type) { 69 SpeechType* speech_type) {
70 CriticalSectionScoped cs(encoder_lock_.get());
70 return encoder()->Decode(encoded, encoded_len, sample_rate_hz, 71 return encoder()->Decode(encoded, encoded_len, sample_rate_hz,
71 max_decoded_bytes, decoded, speech_type); 72 max_decoded_bytes, decoded, speech_type);
72 } 73 }
73 74
74 int AudioEncoderDecoderMutableIsacFix::DecodeRedundant( 75 int AudioEncoderDecoderMutableIsacFix::DecodeRedundant(
75 const uint8_t* encoded, 76 const uint8_t* encoded,
76 size_t encoded_len, 77 size_t encoded_len,
77 int sample_rate_hz, 78 int sample_rate_hz,
78 size_t max_decoded_bytes, 79 size_t max_decoded_bytes,
79 int16_t* decoded, 80 int16_t* decoded,
80 SpeechType* speech_type) { 81 SpeechType* speech_type) {
82 CriticalSectionScoped cs(encoder_lock_.get());
81 return encoder()->DecodeRedundant(encoded, encoded_len, sample_rate_hz, 83 return encoder()->DecodeRedundant(encoded, encoded_len, sample_rate_hz,
82 max_decoded_bytes, decoded, speech_type); 84 max_decoded_bytes, decoded, speech_type);
83 } 85 }
84 86
85 bool AudioEncoderDecoderMutableIsacFix::HasDecodePlc() const { 87 bool AudioEncoderDecoderMutableIsacFix::HasDecodePlc() const {
88 CriticalSectionScoped cs(encoder_lock_.get());
86 return encoder()->HasDecodePlc(); 89 return encoder()->HasDecodePlc();
87 } 90 }
88 91
89 int AudioEncoderDecoderMutableIsacFix::DecodePlc(int num_frames, 92 int AudioEncoderDecoderMutableIsacFix::DecodePlc(int num_frames,
90 int16_t* decoded) { 93 int16_t* decoded) {
94 CriticalSectionScoped cs(encoder_lock_.get());
91 return encoder()->DecodePlc(num_frames, decoded); 95 return encoder()->DecodePlc(num_frames, decoded);
92 } 96 }
93 97
94 int AudioEncoderDecoderMutableIsacFix::Init() { 98 int AudioEncoderDecoderMutableIsacFix::Init() {
99 CriticalSectionScoped cs(encoder_lock_.get());
95 return encoder()->Init(); 100 return encoder()->Init();
96 } 101 }
97 102
98 int AudioEncoderDecoderMutableIsacFix::IncomingPacket( 103 int AudioEncoderDecoderMutableIsacFix::IncomingPacket(
99 const uint8_t* payload, 104 const uint8_t* payload,
100 size_t payload_len, 105 size_t payload_len,
101 uint16_t rtp_sequence_number, 106 uint16_t rtp_sequence_number,
102 uint32_t rtp_timestamp, 107 uint32_t rtp_timestamp,
103 uint32_t arrival_timestamp) { 108 uint32_t arrival_timestamp) {
109 CriticalSectionScoped cs(encoder_lock_.get());
104 return encoder()->IncomingPacket(payload, payload_len, rtp_sequence_number, 110 return encoder()->IncomingPacket(payload, payload_len, rtp_sequence_number,
105 rtp_timestamp, arrival_timestamp); 111 rtp_timestamp, arrival_timestamp);
106 } 112 }
107 113
108 int AudioEncoderDecoderMutableIsacFix::ErrorCode() { 114 int AudioEncoderDecoderMutableIsacFix::ErrorCode() {
115 CriticalSectionScoped cs(encoder_lock_.get());
109 return encoder()->ErrorCode(); 116 return encoder()->ErrorCode();
110 } 117 }
111 118
112 int AudioEncoderDecoderMutableIsacFix::PacketDuration( 119 int AudioEncoderDecoderMutableIsacFix::PacketDuration(
113 const uint8_t* encoded, 120 const uint8_t* encoded,
114 size_t encoded_len) const { 121 size_t encoded_len) const {
122 CriticalSectionScoped cs(encoder_lock_.get());
115 return encoder()->PacketDuration(encoded, encoded_len); 123 return encoder()->PacketDuration(encoded, encoded_len);
116 } 124 }
117 125
118 int AudioEncoderDecoderMutableIsacFix::PacketDurationRedundant( 126 int AudioEncoderDecoderMutableIsacFix::PacketDurationRedundant(
119 const uint8_t* encoded, 127 const uint8_t* encoded,
120 size_t encoded_len) const { 128 size_t encoded_len) const {
129 CriticalSectionScoped cs(encoder_lock_.get());
121 return encoder()->PacketDurationRedundant(encoded, encoded_len); 130 return encoder()->PacketDurationRedundant(encoded, encoded_len);
122 } 131 }
123 132
124 bool AudioEncoderDecoderMutableIsacFix::PacketHasFec(const uint8_t* encoded, 133 bool AudioEncoderDecoderMutableIsacFix::PacketHasFec(const uint8_t* encoded,
125 size_t encoded_len) const { 134 size_t encoded_len) const {
135 CriticalSectionScoped cs(encoder_lock_.get());
126 return encoder()->PacketHasFec(encoded, encoded_len); 136 return encoder()->PacketHasFec(encoded, encoded_len);
127 } 137 }
128 138
129 size_t AudioEncoderDecoderMutableIsacFix::Channels() const { 139 size_t AudioEncoderDecoderMutableIsacFix::Channels() const {
140 CriticalSectionScoped cs(encoder_lock_.get());
130 return encoder()->Channels(); 141 return encoder()->Channels();
131 } 142 }
132 143
133 } // namespace webrtc 144 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698