Changeset 268837 in webkit
- Timestamp:
- Oct 21, 2020, 3:16:06 PM (6 years ago)
- Location:
- branches/safari-610-branch/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
-
branches/safari-610-branch/Source/WebCore/ChangeLog
r268836 r268837 1 2020-10-21 Russell Epstein <repstein@apple.com> 2 3 Cherry-pick r268398. rdar://problem/70541902 4 5 Webcam video from navigator.mediaDevices.getUserMedia() to 2D canvas fails on Safari on iPhone 6 https://bugs.webkit.org/show_bug.cgi?id=217578 7 <rdar://problem/70183875> 8 9 Reviewed by Eric Carlson. 10 11 It is unneeded for MediaStream video backends to enqueue samples to the display layer if the video element is hidden. 12 In iOS, the samples may never be flushed which might cause capture failing after enqueuing too many camera samples. 13 To avoid that, we no longer enqueue samples to the display layer when the player is not visible. 14 In case of canvas painting, other backends need to be made visible for canvas painting to work. 15 For MediaStream backend, we do not need that since we always keep the last sample. 16 For that reason, we keep the backend as not visible even if canvas happens. 17 We do so by introducing a setVisibleForCanvas that is a no-op for MediaStream backend and similar to setVisible for other backends. 18 For good measure, we now flush the MediaStream display layer whenever visibility changed. 19 20 Manually tested. 21 22 * html/HTMLVideoElement.cpp: 23 (WebCore::HTMLVideoElement::paintCurrentFrameInContext): 24 * platform/graphics/MediaPlayer.cpp: 25 (WebCore::MediaPlayer::setVisibleForCanvas): 26 * platform/graphics/MediaPlayer.h: 27 * platform/graphics/MediaPlayerPrivate.h: 28 (WebCore::MediaPlayerPrivateInterface::setVisibleForCanvas): 29 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: 30 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: 31 (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample): 32 (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVisible): 33 (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVisibleForCanvas): 34 35 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268398 268f45cc-cd09-0410-ab3c-d52691b4dbfc 36 37 2020-10-13 Youenn Fablet <youenn@apple.com> 38 39 Webcam video from navigator.mediaDevices.getUserMedia() to 2D canvas fails on Safari on iPhone 40 https://bugs.webkit.org/show_bug.cgi?id=217578 41 <rdar://problem/70183875> 42 43 Reviewed by Eric Carlson. 44 45 It is unneeded for MediaStream video backends to enqueue samples to the display layer if the video element is hidden. 46 In iOS, the samples may never be flushed which might cause capture failing after enqueuing too many camera samples. 47 To avoid that, we no longer enqueue samples to the display layer when the player is not visible. 48 In case of canvas painting, other backends need to be made visible for canvas painting to work. 49 For MediaStream backend, we do not need that since we always keep the last sample. 50 For that reason, we keep the backend as not visible even if canvas happens. 51 We do so by introducing a setVisibleForCanvas that is a no-op for MediaStream backend and similar to setVisible for other backends. 52 For good measure, we now flush the MediaStream display layer whenever visibility changed. 53 54 Manually tested. 55 56 * html/HTMLVideoElement.cpp: 57 (WebCore::HTMLVideoElement::paintCurrentFrameInContext): 58 * platform/graphics/MediaPlayer.cpp: 59 (WebCore::MediaPlayer::setVisibleForCanvas): 60 * platform/graphics/MediaPlayer.h: 61 * platform/graphics/MediaPlayerPrivate.h: 62 (WebCore::MediaPlayerPrivateInterface::setVisibleForCanvas): 63 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: 64 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: 65 (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample): 66 (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVisible): 67 (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVisibleForCanvas): 68 1 69 2020-10-21 Russell Epstein <repstein@apple.com> 2 70 -
branches/safari-610-branch/Source/WebCore/html/HTMLVideoElement.cpp
r265437 r268837 297 297 return; 298 298 299 player->setVisible (true); // Make player visible or it won't draw.299 player->setVisibleForCanvas(true); // Make player visible or it won't draw. 300 300 player->paintCurrentFrameInContext(context, destRect); 301 301 } -
branches/safari-610-branch/Source/WebCore/platform/graphics/MediaPlayer.cpp
r267268 r268837 952 952 } 953 953 954 void MediaPlayer::setVisibleForCanvas(bool visible) 955 { 956 m_visible = visible; 957 m_private->setVisibleForCanvas(visible); 958 } 959 954 960 MediaPlayer::Preload MediaPlayer::preload() const 955 961 { -
branches/safari-610-branch/Source/WebCore/platform/graphics/MediaPlayer.h
r264710 r268837 345 345 bool visible() const; 346 346 void setVisible(bool); 347 void setVisibleForCanvas(bool); 347 348 348 349 void prepareToPlay(); -
branches/safari-610-branch/Source/WebCore/platform/graphics/MediaPlayerPrivate.h
r264710 r268837 96 96 97 97 virtual void setVisible(bool) = 0; 98 virtual void setVisibleForCanvas(bool visible) { setVisible(visible); } 98 99 99 100 virtual float duration() const { return 0; } -
branches/safari-610-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h
r262410 r268837 125 125 126 126 void setVisible(bool) final; 127 void setVisibleForCanvas(bool) final; 127 128 128 129 MediaTime durationMediaTime() const override; -
branches/safari-610-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm
r264312 r268837 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.