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

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

Issue 2777583002: Move getUserMedia finish to "when audio track configured". (Closed)
Patch Set: Thread-safety on unittest Created 3 years, 8 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_track.cc
diff --git a/content/renderer/media/media_stream_audio_track.cc b/content/renderer/media/media_stream_audio_track.cc
index cb64f8af18db392cdee6789560a9c5e0659857c3..4c84585d689c5160de661cf09042c327e04b2d80 100644
--- a/content/renderer/media/media_stream_audio_track.cc
+++ b/content/renderer/media/media_stream_audio_track.cc
@@ -118,6 +118,18 @@ void MediaStreamAudioTrack::Stop() {
}
void MediaStreamAudioTrack::OnSetFormat(const media::AudioParameters& params) {
+ format_is_set_ = true;
+ base::OnceCallback<void()> temp_callback;
+ // Call the callback if present, but don't hold a lock while doing so.
+ {
+ base::AutoLock guard(format_set_callback_guard_);
+ if (!format_set_callback_.is_null()) {
+ temp_callback = std::move(format_set_callback_);
+ }
+ }
+ if (!temp_callback.is_null()) {
+ std::move(temp_callback).Run();
+ }
deliverer_.OnSetFormat(params);
}
@@ -143,8 +155,7 @@ void MediaStreamAudioTrack::OnData(const media::AudioBus& audio_bus,
void MediaStreamAudioTrack::getSettings(
blink::WebMediaStreamTrack::Settings& settings) {
- // TODO(hta): Extract the real value.
- settings.deviceId = blink::WebString("audio device ID");
+ DCHECK(format_is_set_);
Guido Urdaneta 2017/04/06 13:18:57 Does format_is_set_ need to be protected by the lo
hta - Chromium 2017/04/06 13:57:51 I put it on protection; not sure it's required for
Guido Urdaneta 2017/04/06 14:01:05 You solved it in a nicer way :)
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698