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

Issue 1176303004: Fix a data race in AudioEncoderMutableImpl and derived classes (Closed)

Created:
5 years, 6 months ago by hlundin-webrtc
Modified:
5 years, 6 months ago
Reviewers:
Jelena, kwiberg-webrtc
CC:
webrtc-reviews_webrtc.org, tterriberry_mozilla.com, kwiberg-webrtc, tlegrand-webrtc
Base URL:
https://chromium.googlesource.com/external/webrtc.git@master
Target Ref:
refs/pending/heads/master
Project:
webrtc
Visibility:
Public.

Description

Fix a data race in AudioEncoderMutableImpl and derived classes Before this change, it could happen that a caller would get a pointer to the encoder_ but not use it before another thread called the Reconstruct method, changing the pointer. This of course resulted in bad access crashes. With this change, each use of the pointer acquired from the encoder() method is protected by the same lock that is required to update the pointer. Note that this fix is probably too aggressive, since it also affects the Opus implementation; the crash has so far only been seen for iSAC. Also adding a test to trigger the problem. The test did not trigger the problem deterministically, but out would typically find it in less than 1000 runs. BUG=chromium:499468 R=jmarusic@webrtc.org, kwiberg@webrtc.org Committed: https://chromium.googlesource.com/external/webrtc/+/a6aa6d96f8aa10736c76deb2a6ef09027d375a4a

Patch Set 1 #

Total comments: 6

Patch Set 2 : Fix for test racyness #

Patch Set 3 : Including config_ in the critical section #

Patch Set 4 : Return config_ by value instead of reference #

Unified diffs Side-by-side diffs Delta from patch set Stats (+230 lines, -11 lines) Patch
M webrtc/modules/audio_coding/codecs/audio_encoder_mutable_impl.h View 1 2 3 3 chunks +43 lines, -9 lines 0 comments Download
M webrtc/modules/audio_coding/codecs/isac/fix/source/audio_encoder_isacfix.cc View 3 chunks +11 lines, -0 lines 0 comments Download
M webrtc/modules/audio_coding/codecs/isac/main/source/audio_encoder_isac.cc View 3 chunks +11 lines, -0 lines 0 comments Download
M webrtc/modules/audio_coding/codecs/opus/interface/audio_encoder_opus.h View 1 chunk +9 lines, -2 lines 0 comments Download
M webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest_oldapi.cc View 1 2 chunks +155 lines, -0 lines 0 comments Download
M webrtc/modules/modules.gyp View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 13 (1 generated)
hlundin-webrtc
Jelena, Karl, Please, review this CL. Thanks!
5 years, 6 months ago (2015-06-12 13:21:09 UTC) #2
Jelena
Didn't have time to look at the test, but the fix is good. LGTM
5 years, 6 months ago (2015-06-12 15:06:45 UTC) #3
Jelena
https://codereview.webrtc.org/1176303004/diff/1/webrtc/modules/audio_coding/codecs/audio_encoder_mutable_impl.h File webrtc/modules/audio_coding/codecs/audio_encoder_mutable_impl.h (right): https://codereview.webrtc.org/1176303004/diff/1/webrtc/modules/audio_coding/codecs/audio_encoder_mutable_impl.h#newcode97 webrtc/modules/audio_coding/codecs/audio_encoder_mutable_impl.h:97: CriticalSectionScoped cs(encoder_lock_.get()); Actually, lock needs to protect the config_ ...
5 years, 6 months ago (2015-06-13 09:47:50 UTC) #4
kwiberg-webrtc
> Fix a data race in AudioEncoderMutableImpl and derived classes > > Before this change, ...
5 years, 6 months ago (2015-06-13 20:10:54 UTC) #5
kwiberg-webrtc
lgtm https://codereview.webrtc.org/1176303004/diff/1/webrtc/modules/audio_coding/codecs/audio_encoder_mutable_impl.h File webrtc/modules/audio_coding/codecs/audio_encoder_mutable_impl.h (right): https://codereview.webrtc.org/1176303004/diff/1/webrtc/modules/audio_coding/codecs/audio_encoder_mutable_impl.h#newcode97 webrtc/modules/audio_coding/codecs/audio_encoder_mutable_impl.h:97: CriticalSectionScoped cs(encoder_lock_.get()); On 2015/06/13 09:47:50, Jelena wrote: > ...
5 years, 6 months ago (2015-06-13 20:27:49 UTC) #6
Jelena
On 2015/06/13 20:27:49, kwiberg1 wrote: > lgtm > > https://codereview.webrtc.org/1176303004/diff/1/webrtc/modules/audio_coding/codecs/audio_encoder_mutable_impl.h > File webrtc/modules/audio_coding/codecs/audio_encoder_mutable_impl.h (right): > ...
5 years, 6 months ago (2015-06-15 07:37:35 UTC) #7
hlundin-webrtc
Including config_ in the critical section
5 years, 6 months ago (2015-06-15 09:31:51 UTC) #8
hlundin-webrtc
Return config_ by value instead of reference
5 years, 6 months ago (2015-06-15 09:37:23 UTC) #9
hlundin-webrtc
Thanks for the comments. Please, see new patch set before I commit. https://codereview.webrtc.org/1176303004/diff/1/webrtc/modules/audio_coding/codecs/audio_encoder_mutable_impl.h File webrtc/modules/audio_coding/codecs/audio_encoder_mutable_impl.h ...
5 years, 6 months ago (2015-06-15 09:38:10 UTC) #10
kwiberg-webrtc
lgtm
5 years, 6 months ago (2015-06-15 11:12:19 UTC) #11
Jelena
lgtm
5 years, 6 months ago (2015-06-15 11:34:27 UTC) #12
hlundin-webrtc
5 years, 6 months ago (2015-06-15 11:46:30 UTC) #13
Message was sent while issue was closed.
Committed patchset #4 (id:60001) manually as
a6aa6d96f8aa10736c76deb2a6ef09027d375a4a (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698