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

Unified Diff: third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp

Issue 2922733002: Propagate muted state from MediaStreamAudioSource into JS. (Closed)
Patch Set: Made SetMuted call unconditional. Rebased. Created 3 years, 6 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/mediastream/MediaStreamTrack-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp
index b6da23929cd3921e44e542ffcb43a041f68eca61..58e16b2d2a87ad6560230e0559dd12a9a65ce729 100644
--- a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp
+++ b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp
@@ -64,7 +64,7 @@ MediaStreamTrack* MediaStreamTrack::Create(ExecutionContext* context,
MediaStreamTrack::MediaStreamTrack(ExecutionContext* context,
MediaStreamComponent* component)
: ContextLifecycleObserver(context),
- ready_state_(MediaStreamSource::kReadyStateLive),
+ ready_state_(component->Source()->GetReadyState()),
is_iterating_registered_media_streams_(false),
stopped_(false),
component_(component),
@@ -72,6 +72,10 @@ MediaStreamTrack::MediaStreamTrack(ExecutionContext* context,
constraints_() {
component_->Source()->AddObserver(this);
+ // If the source is already non-live at this point, the observer won't have
+ // been called. Update the muted state manually.
+ component_->SetMuted(ready_state_ == MediaStreamSource::kReadyStateMuted);
+
if (component_->Source() &&
component_->Source()->GetType() == MediaStreamSource::kTypeVideo) {
// ImageCapture::create() only throws if |this| track is not of video type.
@@ -183,11 +187,12 @@ String MediaStreamTrack::readyState() const {
if (Ended())
return "ended";
+ // Although muted is tracked as a ReadyState, only "live" and "ended" are
+ // visible externally.
switch (ready_state_) {
case MediaStreamSource::kReadyStateLive:
- return "live";
case MediaStreamSource::kReadyStateMuted:
- return "muted";
+ return "live";
case MediaStreamSource::kReadyStateEnded:
return "ended";
}
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/mediastream/MediaStreamTrack-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698