Changeset 268398 in webkit
- Timestamp:
- Oct 13, 2020, 10:06:16 AM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
-
ChangeLog (modified) (1 diff)
-
html/HTMLVideoElement.cpp (modified) (1 diff)
-
platform/graphics/MediaPlayer.cpp (modified) (1 diff)
-
platform/graphics/MediaPlayer.h (modified) (1 diff)
-
platform/graphics/MediaPlayerPrivate.h (modified) (1 diff)
-
platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h (modified) (1 diff)
-
platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r268396 r268398 1 2020-10-13 Youenn Fablet <youenn@apple.com> 2 3 Webcam video from navigator.mediaDevices.getUserMedia() to 2D canvas fails on Safari on iPhone 4 https://bugs.webkit.org/show_bug.cgi?id=217578 5 <rdar://problem/70183875> 6 7 Reviewed by Eric Carlson. 8 9 It is unneeded for MediaStream video backends to enqueue samples to the display layer if the video element is hidden. 10 In iOS, the samples may never be flushed which might cause capture failing after enqueuing too many camera samples. 11 To avoid that, we no longer enqueue samples to the display layer when the player is not visible. 12 In case of canvas painting, other backends need to be made visible for canvas painting to work. 13 For MediaStream backend, we do not need that since we always keep the last sample. 14 For that reason, we keep the backend as not visible even if canvas happens. 15 We do so by introducing a setVisibleForCanvas that is a no-op for MediaStream backend and similar to setVisible for other backends. 16 For good measure, we now flush the MediaStream display layer whenever visibility changed. 17 18 Manually tested. 19 20 * html/HTMLVideoElement.cpp: 21 (WebCore::HTMLVideoElement::paintCurrentFrameInContext): 22 * platform/graphics/MediaPlayer.cpp: 23 (WebCore::MediaPlayer::setVisibleForCanvas): 24 * platform/graphics/MediaPlayer.h: 25 * platform/graphics/MediaPlayerPrivate.h: 26 (WebCore::MediaPlayerPrivateInterface::setVisibleForCanvas): 27 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: 28 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: 29 (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample): 30 (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVisible): 31 (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVisibleForCanvas): 32 1 33 2020-10-13 Youenn Fablet <youenn@apple.com> 2 34 -
trunk/Source/WebCore/html/HTMLVideoElement.cpp
r268299 r268398 305 305 return; 306 306 307 player->setVisible (true); // Make player visible or it won't draw.307 player->setVisibleForCanvas(true); // Make player visible or it won't draw. 308 308 context.paintFrameForMedia(*player, destRect); 309 309 } -
trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp
r268145 r268398 963 963 } 964 964 965 void MediaPlayer::setVisibleForCanvas(bool visible) 966 { 967 m_visible = visible; 968 m_private->setVisibleForCanvas(visible); 969 } 970 965 971 MediaPlayer::Preload MediaPlayer::preload() const 966 972 { -
trunk/Source/WebCore/platform/graphics/MediaPlayer.h
r268145 r268398 349 349 bool visible() const; 350 350 void setVisible(bool); 351 void setVisibleForCanvas(bool); 351 352 352 353 void prepareToPlay(); -
trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h
r268070 r268398 97 97 98 98 virtual void setVisible(bool) = 0; 99 virtual void setVisibleForCanvas(bool visible) { setVisible(visible); } 99 100 100 101 virtual float duration() const { return 0; } -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h
r267472 r268398 125 125 126 126 void setVisible(bool) final; 127 void setVisibleForCanvas(bool) final; 127 128 128 129 MediaTime durationMediaTime() const override; -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm
r267472 r268398 253 253 void MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample(MediaSample& sample) 254 254 { 255 if (!m_visible) 256 return; 257 255 258 auto locker = tryHoldLock(m_sampleBufferDisplayLayerLock); 256 259 if (!locker) … … 594 597 595 598 m_visible = visible; 596 if (m_visible) 597 flushRenderers(); 599 flushRenderers(); 600 } 601 602 void MediaPlayerPrivateMediaStreamAVFObjC::setVisibleForCanvas(bool) 603 { 598 604 } 599 605
Note:
See TracChangeset
for help on using the changeset viewer.