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

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

Issue 857093002: Set audio format before adding pepper sink to audio track. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments. Created 5 years, 11 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 4ed3e215ddffb6a4359020ceff26041c382baeaa..2c93bd2d9aa0e898251c5b36293335ca07647b6e 100644
--- a/content/renderer/pepper/pepper_media_stream_audio_track_host.h
+++ b/content/renderer/pepper/pepper_media_stream_audio_track_host.h
@@ -52,6 +52,16 @@ class PepperMediaStreamAudioTrackHost : public PepperMediaStreamTrackHostBase {
// Send a reply to the currently pending |Configure()| request.
void SendConfigureReply(int32_t result);
+ // MediaStreamAudioSink overrides:
+ // These two functions should be called on the audio thread.
+ // NOTE: For this specific instance, |OnSetFormat()| is also called on the
+ // main thread. However, the call to |OnSetFormat()| happens before this
+ // sink is added to an audio track, also on the main thread, which should
+ // avoid any potential races.
+ void OnData(const media::AudioBus& audio_bus,
+ base::TimeTicks estimated_capture_time) override;
+ void OnSetFormat(const media::AudioParameters& params) override;
+
private:
// Initializes buffers on the main thread.
void SetFormatOnMainThread(int bytes_per_second, int bytes_per_frame);
@@ -62,12 +72,6 @@ class PepperMediaStreamAudioTrackHost : public PepperMediaStreamTrackHostBase {
void SendEnqueueBufferMessageOnMainThread(int32_t index,
int32_t buffers_generation);
- // MediaStreamAudioSink overrides:
- // These two functions should be called on the audio thread.
- void OnData(const media::AudioBus& audio_bus,
- base::TimeTicks estimated_capture_time) override;
- void OnSetFormat(const media::AudioParameters& params) override;
-
// Unowned host which is available during the AudioSink's lifespan.
// It is mainly used in the main thread. But the audio thread will use
// host_->buffer_manager() to read some buffer properties. It is safe

Powered by Google App Engine
This is Rietveld 408576698