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

Unified Diff: content/renderer/pepper/pepper_media_stream_audio_track_host.h

Issue 417753002: Fix a race condition in MediaStreamAudioTrackHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 6 years, 5 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/pepper/pepper_media_stream_audio_track_host.h
diff --git a/content/renderer/pepper/pepper_media_stream_audio_track_host.h b/content/renderer/pepper/pepper_media_stream_audio_track_host.h
index 348103c9928c55faa4c7beca1e0259b2347e07a4..8615ac508b0e9c1d7ca67ee60880b77944f72275 100644
--- a/content/renderer/pepper/pepper_media_stream_audio_track_host.h
+++ b/content/renderer/pepper/pepper_media_stream_audio_track_host.h
@@ -54,7 +54,8 @@ class PepperMediaStreamAudioTrackHost : public PepperMediaStreamTrackHostBase {
void InitBuffers();
// Send enqueue buffer message on the main thread.
- void SendEnqueueBufferMessageOnMainThread(int32_t index);
+ void SendEnqueueBufferMessageOnMainThread(int32_t index,
+ int32_t buffers_generation);
// MediaStreamAudioSink overrides:
// These two functions should be called on the audio thread.
@@ -92,12 +93,16 @@ class PepperMediaStreamAudioTrackHost : public PepperMediaStreamTrackHostBase {
// Access only on the audio thread.
uint32_t buffer_data_size_;
- // A lock to protect the index queue |buffers_|.
+ // A lock to protect the index queue |buffers_|, |buffers_generation_| and
+ // buffers in |host_->buffer_manager()|.
base::Lock lock_;
// A queue for free buffer indices.
std::deque<int32_t> buffers_;
+ // Generation of buffers. It is increased by every |InitBuffers()| call.
+ int32_t buffers_generation_;
+
scoped_refptr<base::MessageLoopProxy> main_message_loop_proxy_;
base::ThreadChecker audio_thread_checker_;
« no previous file with comments | « chrome/test/ppapi/ppapi_browsertest.cc ('k') | content/renderer/pepper/pepper_media_stream_audio_track_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698