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

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

Powered by Google App Engine
This is Rietveld 408576698