Changeset 214980 in webkit


Ignore:
Timestamp:
Apr 5, 2017, 5:03:44 PM (8 years ago)
Author:
eric.carlson@apple.com
Message:

[MediaStream] Host application should be able to mute and unmute media streams
https://bugs.webkit.org/show_bug.cgi?id=170519
<rdar://problem/31174326>

Unreviewed, address review comments missed in the initial checkin.

  • Modules/mediastream/MediaStream.cpp:

(WebCore::MediaStream::MediaStream): Mute the private stream if the page doesn't allow
capture.
(WebCore::MediaStream::pageMutedStateDidChange): setMuted -> setCaptureTracksMuted.

  • platform/mediastream/MediaStreamPrivate.cpp:

(WebCore::MediaStreamPrivate::addTrack): Don't track muted state, the capture source already does.
(WebCore::MediaStreamPrivate::startProducingData): Ditto.
(WebCore::MediaStreamPrivate::setCaptureTracksMuted): Renamed from setMuted.
(WebCore::MediaStreamPrivate::setMuted): Deleted.

  • platform/mediastream/MediaStreamPrivate.h:
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r214976 r214980  
     12017-04-05  Eric Carlson  <eric.carlson@apple.com>
     2
     3        [MediaStream] Host application should be able to mute and unmute media streams
     4        https://bugs.webkit.org/show_bug.cgi?id=170519
     5        <rdar://problem/31174326>
     6
     7        Unreviewed, address review comments missed in the initial checkin.
     8
     9        * Modules/mediastream/MediaStream.cpp:
     10        (WebCore::MediaStream::MediaStream): Mute the private stream if the page doesn't allow
     11        capture.
     12        (WebCore::MediaStream::pageMutedStateDidChange): setMuted -> setCaptureTracksMuted.
     13
     14        * platform/mediastream/MediaStreamPrivate.cpp:
     15        (WebCore::MediaStreamPrivate::addTrack): Don't track muted state, the capture source already does.
     16        (WebCore::MediaStreamPrivate::startProducingData):  Ditto.
     17        (WebCore::MediaStreamPrivate::setCaptureTracksMuted): Renamed from setMuted.
     18        (WebCore::MediaStreamPrivate::setMuted): Deleted.
     19        * platform/mediastream/MediaStreamPrivate.h:
     20
    1212017-04-05  Eric Carlson  <eric.carlson@apple.com>
    222
  • trunk/Source/WebCore/Modules/mediastream/MediaStream.cpp

    r214976 r214980  
    9191{
    9292    ASSERT(m_private);
     93
    9394    setIsActive(m_private->active());
     95    if (document()->page()->isMediaCaptureMuted())
     96        m_private->setCaptureTracksMuted(true);
    9497    m_private->addObserver(*this);
    9598    MediaStreamRegistry::shared().registerStream(*this);
     
    301304        return;
    302305
    303     m_private->setMuted(document->page()->isMediaCaptureMuted());
     306    m_private->setCaptureTracksMuted(document->page()->isMediaCaptureMuted());
    304307}
    305308
  • trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.cpp

    r214976 r214980  
    135135        return;
    136136
    137     if (m_muted)
    138         track->stopProducingData();
    139 
    140137    track->addObserver(*this);
    141138    m_trackSet.add(track->id(), track);
     
    166163void MediaStreamPrivate::startProducingData()
    167164{
    168     if (m_muted)
    169         return;
    170 
    171165    for (auto& track : m_trackSet.values())
    172166        track->startProducingData();
     
    188182}
    189183
    190 void MediaStreamPrivate::setMuted(bool muted)
    191 {
    192     if (m_muted == muted)
    193         return;
    194 
    195     m_muted = muted;
     184void MediaStreamPrivate::setCaptureTracksMuted(bool muted)
     185{
    196186    for (auto& track : m_trackSet.values()) {
    197187        if (track->isCaptureTrack())
  • trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.h

    r214976 r214980  
    9696    bool hasVideo() const;
    9797    bool hasAudio() const;
    98 
    99     void setMuted(bool);
    10098    bool muted() const;
    10199
    102100    bool hasCaptureVideoSource() const;
    103101    bool hasCaptureAudioSource() const;
     102    void setCaptureTracksMuted(bool);
    104103
    105104    FloatSize intrinsicSize() const;
     
    137136    HashMap<String, RefPtr<MediaStreamTrackPrivate>> m_trackSet;
    138137    bool m_isActive { false };
    139     bool m_muted { false };
    140138};
    141139
Note: See TracChangeset for help on using the changeset viewer.