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

Unified Diff: content/renderer/media/external_media_stream_audio_source.cc

Issue 2622073003: Fix getUserMedia so that failure is reported for invalid audio sources. (Closed)
Patch Set: Change approach to be more conservative. Instead adapt OnAudioSourceStarted to the current design a… Created 3 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/media/external_media_stream_audio_source.cc
diff --git a/content/renderer/media/external_media_stream_audio_source.cc b/content/renderer/media/external_media_stream_audio_source.cc
index 7c2977c2907c46249730468bb2f63b81ffbe75a3..01b32ad6b3d46b57271791cb2cd645386f909cf9 100644
--- a/content/renderer/media/external_media_stream_audio_source.cc
+++ b/content/renderer/media/external_media_stream_audio_source.cc
@@ -40,7 +40,10 @@ bool ExternalMediaStreamAudioSource::EnsureSourceIsStarted() {
<< GetAudioParameters().AsHumanReadableString() << "}.";
source_->Initialize(GetAudioParameters(), this, -1);
source_->Start();
- was_started_ = true;
+ // OnCaptureStarted() is expected to be called synchronously by this
miu 2017/01/11 20:51:11 I don't think it's synchronous. The callback origi
tommi (sloooow) - chröme 2017/01/11 22:40:58 OK, I traced through the code and may have missed
miu 2017/01/12 21:25:37 IIRC, the original implementor added browser tests
+ // implementation. If this needs to be changed, the source needs to be started
+ // outside of EnsureSourceIsStarted since its design is synchronous.
+ CHECK(was_started_);
return true;
}
@@ -57,6 +60,10 @@ void ExternalMediaStreamAudioSource::EnsureSourceIsStopped() {
<< GetAudioParameters().AsHumanReadableString() << "}.";
}
+void ExternalMediaStreamAudioSource::OnCaptureStarted() {
+ was_started_ = true;
+}
+
void ExternalMediaStreamAudioSource::Capture(const media::AudioBus* audio_bus,
int audio_delay_milliseconds,
double volume,

Powered by Google App Engine
This is Rietveld 408576698