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

Unified Diff: content/renderer/media/media_stream_audio_processor.h

Issue 2425353002: Data race fix: Replace use of MessageLoop raw pointer in MSAudioProcessor. (Closed)
Patch Set: Created 4 years, 2 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: content/renderer/media/media_stream_audio_processor.h
diff --git a/content/renderer/media/media_stream_audio_processor.h b/content/renderer/media/media_stream_audio_processor.h
index 28cccdb4908af6fb4e93d5d75a27e2d7ab1bf5d5..82f10b7ed22f5d1024e09839e7e5907a455e2566 100644
--- a/content/renderer/media/media_stream_audio_processor.h
+++ b/content/renderer/media/media_stream_audio_processor.h
@@ -9,6 +9,8 @@
#include "base/files/file.h"
#include "base/gtest_prod_util.h"
#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/single_thread_task_runner.h"
#include "base/synchronization/lock.h"
#include "base/threading/thread_checker.h"
#include "base/time/time.h"
@@ -56,6 +58,9 @@ class CONTENT_EXPORT MediaStreamAudioProcessor :
// |playout_data_source| is used to register this class as a sink to the
// WebRtc playout data for processing AEC. If clients do not enable AEC,
// |playout_data_source| won't be used.
+ //
+ // Threading note: The constructor assumes it is being run on the main render
+ // thread.
MediaStreamAudioProcessor(
const blink::WebMediaConstraints& constraints,
const MediaStreamDevice::AudioDeviceParameters& input_params,
@@ -197,17 +202,14 @@ class CONTENT_EXPORT MediaStreamAudioProcessor :
// lifetime of RenderThread.
WebRtcPlayoutDataSource* playout_data_source_;
- // Used to DCHECK that some methods are called on the main render thread.
- base::ThreadChecker main_thread_checker_;
+ // Task runner for the main render thread.
+ const scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner_;
+
// Used to DCHECK that some methods are called on the capture audio thread.
base::ThreadChecker capture_thread_checker_;
// Used to DCHECK that some methods are called on the render audio thread.
base::ThreadChecker render_thread_checker_;
- // Message loop for the main render thread. We're assuming that we're created
- // on the main render thread.
- base::MessageLoop* main_thread_message_loop_;
-
// Flag to enable stereo channel mirroring.
bool audio_mirroring_;

Powered by Google App Engine
This is Rietveld 408576698