Changeset 273069 in webkit


Ignore:
Timestamp:
Feb 18, 2021 12:43:51 AM (3 years ago)
Author:
youenn@apple.com
Message:

Backgrounding a page that is playing and capturing audio will stop audio playing
https://bugs.webkit.org/show_bug.cgi?id=222032
<rdar://problem/74389497>

Reviewed by Eric Carlson.

When a page gets backgrounded while capturing, it will continue doing capture, as can be seen with the red status bar.
In that case, for video conferencing, it makes sense that audio being played continues playing, at least for MediaStreamTrack.
The red status bar is an indication that the call is continuing.
Also, for MediaStreamTrack, audio and video content are not buffered: they are played or discarded.
The media player, whenever not visible, will stop processing video but will continue processing audio if not interrupted.
This makes it working for websites using video elements for both audio and video, which is more common than websites using video elements for video and audio elements for audio.

Manually tested.

  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction const):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r273068 r273069  
     12021-02-18  Youenn Fablet  <youenn@apple.com>
     2
     3        Backgrounding a page that is playing and capturing audio will stop audio playing
     4        https://bugs.webkit.org/show_bug.cgi?id=222032
     5        <rdar://problem/74389497>
     6
     7        Reviewed by Eric Carlson.
     8
     9        When a page gets backgrounded while capturing, it will continue doing capture, as can be seen with the red status bar.
     10        In that case, for video conferencing, it makes sense that audio being played continues playing, at least for MediaStreamTrack.
     11        The red status bar is an indication that the call is continuing.
     12        Also, for MediaStreamTrack, audio and video content are not buffered: they are played or discarded.
     13        The media player, whenever not visible, will stop processing video but will continue processing audio if not interrupted.
     14        This makes it working for websites using video elements for both audio and video, which is more common than websites using video elements for video and audio elements for audio.
     15
     16        Manually tested.
     17
     18        * html/HTMLMediaElement.cpp:
     19        (WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction const):
     20
    1212021-02-18  Rob Buis  <rbuis@igalia.com>
    222
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r272920 r273069  
    75787578            return true;
    75797579#endif
     7580#if ENABLE(MEDIA_STREAM)
     7581        if (hasMediaStreamSrcObject() && mediaState() & IsPlayingAudio && document().mediaState() & MediaProducer::HasActiveAudioCaptureDevice) {
     7582            INFO_LOG(LOGIDENTIFIER, "returning true because playing an audio MediaStreamTrack");
     7583            return true;
     7584        }
     7585#endif
    75807586    } else if (type == PlatformMediaSession::SuspendedUnderLock) {
    75817587        if (isPlayingToExternalTarget()) {
     
    75877593            return true;
    75887594        }
     7595#if ENABLE(MEDIA_STREAM)
     7596        if (hasMediaStreamSrcObject() && mediaState() & IsPlayingAudio && document().mediaState() & MediaProducer::HasActiveAudioCaptureDevice) {
     7597            INFO_LOG(LOGIDENTIFIER, "returning true because playing an audio MediaStreamTrack");
     7598            return true;
     7599        }
     7600#endif
    75897601    }
    75907602    return false;
Note: See TracChangeset for help on using the changeset viewer.