Changeset 221046 in webkit
- Timestamp:
- Aug 22, 2017 2:04:59 PM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r221033 r221046 1 2017-08-22 Jer Noble <jer.noble@apple.com> 2 3 Refactor videoPerformanceQuality() MediaPlayer methods into single call. 4 https://bugs.webkit.org/show_bug.cgi?id=175830 5 6 Reviewed by Eric Carlson. 7 8 Allow MediaPlayerPrivate subclasses to return all the metrics required for VideoPerformanceQuality in 9 a single call. For clients which incur significant overhead to request this data, this reduces the cost 10 of requesting data by the number of calls removed. 11 12 * html/HTMLMediaElement.cpp: 13 (WebCore::HTMLMediaElement::getVideoPlaybackQuality): 14 * platform/graphics/MediaPlayer.cpp: 15 (WebCore::MediaPlayer::videoPlaybackQualityMetrics): 16 (WebCore::MediaPlayer::totalVideoFrames): Deleted. 17 (WebCore::MediaPlayer::droppedVideoFrames): Deleted. 18 (WebCore::MediaPlayer::corruptedVideoFrames): Deleted. 19 (WebCore::MediaPlayer::totalFrameDelay): Deleted. 20 * platform/graphics/MediaPlayer.h: 21 (WebCore::PlatformVideoPlaybackQualityMetrics::PlatformVideoPlaybackQualityMetrics): 22 * platform/graphics/MediaPlayerPrivate.h: 23 (WebCore::MediaPlayerPrivateInterface::videoPlaybackQualityMetrics): 24 (WebCore::MediaPlayerPrivateInterface::totalVideoFrames): Deleted. 25 (WebCore::MediaPlayerPrivateInterface::droppedVideoFrames): Deleted. 26 (WebCore::MediaPlayerPrivateInterface::corruptedVideoFrames): Deleted. 27 (WebCore::MediaPlayerPrivateInterface::totalFrameDelay): Deleted. 28 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: 29 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: 30 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::videoPlaybackQualityMetrics): 31 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::totalVideoFrames): Deleted. 32 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::droppedVideoFrames): Deleted. 33 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::corruptedVideoFrames): Deleted. 34 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::totalFrameDelay): Deleted. 35 * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h: 36 * platform/mock/mediasource/MockMediaPlayerMediaSource.cpp: 37 (WebCore::MockMediaPlayerMediaSource::videoPlaybackQualityMetrics): 38 (WebCore::MockMediaPlayerMediaSource::totalVideoFrames): Deleted. 39 (WebCore::MockMediaPlayerMediaSource::droppedVideoFrames): Deleted. 40 (WebCore::MockMediaPlayerMediaSource::corruptedVideoFrames): Deleted. 41 (WebCore::MockMediaPlayerMediaSource::totalFrameDelay): Deleted. 42 * platform/mock/mediasource/MockMediaPlayerMediaSource.h: 43 * platform/mock/mediasource/MockMediaSourcePrivate.cpp: 44 (WebCore::MockMediaSourcePrivate::videoPlaybackQualityMetrics): 45 * platform/mock/mediasource/MockMediaSourcePrivate.h: 46 1 47 2017-08-22 Brent Fulgham <bfulgham@apple.com> 2 48 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r221033 r221046 6903 6903 double timestamp = domWindow ? 1000 * domWindow->nowTimestamp() : 0; 6904 6904 6905 if (!m_player) 6905 auto metrics = m_player ? m_player->videoPlaybackQualityMetrics() : std::nullopt; 6906 if (!metrics) 6906 6907 return VideoPlaybackQuality::create(timestamp, 0, 0, 0, 0); 6907 6908 6908 6909 return VideoPlaybackQuality::create(timestamp, 6909 m _droppedVideoFrames + m_player->totalVideoFrames(),6910 m _droppedVideoFrames + m_player->droppedVideoFrames(),6911 m _player->corruptedVideoFrames(),6912 m _player->totalFrameDelay().toDouble());6910 metrics.value().totalVideoFrames + m_droppedVideoFrames, 6911 metrics.value().droppedVideoFrames + m_droppedVideoFrames, 6912 metrics.value().corruptedVideoFrames, 6913 metrics.value().totalFrameDelay); 6913 6914 } 6914 6915 #endif -
trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp
r220962 r221046 1409 1409 1410 1410 #if ENABLE(MEDIA_SOURCE) 1411 unsigned long MediaPlayer::totalVideoFrames()1411 std::optional<PlatformVideoPlaybackQualityMetrics> MediaPlayer::videoPlaybackQualityMetrics() 1412 1412 { 1413 1413 if (!m_private) 1414 return 0; 1415 1416 return m_private->totalVideoFrames(); 1417 } 1418 1419 unsigned long MediaPlayer::droppedVideoFrames() 1420 { 1421 if (!m_private) 1422 return 0; 1423 1424 return m_private->droppedVideoFrames(); 1425 } 1426 1427 unsigned long MediaPlayer::corruptedVideoFrames() 1428 { 1429 if (!m_private) 1430 return 0; 1431 1432 return m_private->corruptedVideoFrames(); 1433 } 1434 1435 MediaTime MediaPlayer::totalFrameDelay() 1436 { 1437 if (!m_private) 1438 return MediaTime::zeroTime(); 1439 1440 return m_private->totalFrameDelay(); 1414 return std::nullopt; 1415 1416 return m_private->videoPlaybackQualityMetrics(); 1441 1417 } 1442 1418 #endif -
trunk/Source/WebCore/platform/graphics/MediaPlayer.h
r220962 r221046 122 122 }; 123 123 124 struct PlatformVideoPlaybackQualityMetrics { 125 PlatformVideoPlaybackQualityMetrics(unsigned long totalVideoFrames, unsigned long droppedVideoFrames, unsigned long corruptedVideoFrames, double totalFrameDelay) 126 : totalVideoFrames(totalVideoFrames) 127 , droppedVideoFrames(droppedVideoFrames) 128 , corruptedVideoFrames(corruptedVideoFrames) 129 , totalFrameDelay(totalFrameDelay) 130 { 131 } 132 133 unsigned long totalVideoFrames; 134 unsigned long droppedVideoFrames; 135 unsigned long corruptedVideoFrames; 136 double totalFrameDelay; 137 }; 138 124 139 extern const PlatformMedia NoPlatformMedia; 125 140 … … 584 599 585 600 #if ENABLE(MEDIA_SOURCE) 586 unsigned long totalVideoFrames(); 587 unsigned long droppedVideoFrames(); 588 unsigned long corruptedVideoFrames(); 589 MediaTime totalFrameDelay(); 601 std::optional<PlatformVideoPlaybackQualityMetrics> videoPlaybackQualityMetrics(); 590 602 #endif 591 603 -
trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h
r220962 r221046 271 271 272 272 #if ENABLE(MEDIA_SOURCE) 273 virtual unsigned long totalVideoFrames() { return 0; } 274 virtual unsigned long droppedVideoFrames() { return 0; } 275 virtual unsigned long corruptedVideoFrames() { return 0; } 276 virtual MediaTime totalFrameDelay() { return MediaTime::zeroTime(); } 273 virtual std::optional<PlatformVideoPlaybackQualityMetrics> videoPlaybackQualityMetrics() { return std::nullopt; } 277 274 #endif 278 275 -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h
r220577 r221046 217 217 size_t extraMemoryCost() const override; 218 218 219 unsigned long totalVideoFrames() override; 220 unsigned long droppedVideoFrames() override; 221 unsigned long corruptedVideoFrames() override; 222 MediaTime totalFrameDelay() override; 219 std::optional<PlatformVideoPlaybackQualityMetrics> videoPlaybackQualityMetrics() override; 223 220 224 221 #if ENABLE(WIRELESS_PLAYBACK_TARGET) -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm
r220979 r221046 688 688 } 689 689 690 unsigned long MediaPlayerPrivateMediaSourceAVFObjC::totalVideoFrames() 691 { 692 return [[m_sampleBufferDisplayLayer videoPerformanceMetrics] totalNumberOfVideoFrames]; 693 } 694 695 unsigned long MediaPlayerPrivateMediaSourceAVFObjC::droppedVideoFrames() 696 { 697 return [[m_sampleBufferDisplayLayer videoPerformanceMetrics] numberOfDroppedVideoFrames]; 698 } 699 700 unsigned long MediaPlayerPrivateMediaSourceAVFObjC::corruptedVideoFrames() 701 { 702 return [[m_sampleBufferDisplayLayer videoPerformanceMetrics] numberOfCorruptedVideoFrames]; 703 } 704 705 MediaTime MediaPlayerPrivateMediaSourceAVFObjC::totalFrameDelay() 706 { 707 return MediaTime::createWithDouble([[m_sampleBufferDisplayLayer videoPerformanceMetrics] totalFrameDelay]); 690 std::optional<PlatformVideoPlaybackQualityMetrics> MediaPlayerPrivateMediaSourceAVFObjC::videoPlaybackQualityMetrics() 691 { 692 693 auto metrics = [m_sampleBufferDisplayLayer videoPerformanceMetrics]; 694 if (!metrics) 695 return std::nullopt; 696 697 return PlatformVideoPlaybackQualityMetrics( 698 [metrics totalNumberOfVideoFrames], 699 [metrics numberOfDroppedVideoFrames], 700 [metrics numberOfCorruptedVideoFrames], 701 [metrics totalFrameDelay] 702 ); 708 703 } 709 704 -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h
r217966 r221046 102 102 103 103 // FIXME: Implement. 104 unsigned long totalVideoFrames() override { return 0; } 105 unsigned long droppedVideoFrames() override { return 0; } 106 unsigned long corruptedVideoFrames() override { return 0; } 107 MediaTime totalFrameDelay() override { return MediaTime::zeroTime(); } 104 std::optional<PlatformVideoPlaybackQualityMetrics> videoPlaybackQualityMetrics() override { return std::nullopt; } 108 105 bool isTimeBuffered(const MediaTime&) const; 109 106 -
trunk/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp
r219595 r221046 271 271 } 272 272 273 unsigned long MockMediaPlayerMediaSource::totalVideoFrames() 274 { 275 return m_mediaSourcePrivate ? m_mediaSourcePrivate->totalVideoFrames() : 0; 276 } 277 278 unsigned long MockMediaPlayerMediaSource::droppedVideoFrames() 279 { 280 return m_mediaSourcePrivate ? m_mediaSourcePrivate->droppedVideoFrames() : 0; 281 } 282 283 unsigned long MockMediaPlayerMediaSource::corruptedVideoFrames() 284 { 285 return m_mediaSourcePrivate ? m_mediaSourcePrivate->corruptedVideoFrames() : 0; 286 } 287 288 MediaTime MockMediaPlayerMediaSource::totalFrameDelay() 289 { 290 return m_mediaSourcePrivate ? m_mediaSourcePrivate->totalFrameDelay() : MediaTime::zeroTime(); 273 std::optional<PlatformVideoPlaybackQualityMetrics> MockMediaPlayerMediaSource::videoPlaybackQualityMetrics() 274 { 275 return m_mediaSourcePrivate ? m_mediaSourcePrivate->videoPlaybackQualityMetrics() : std::nullopt; 291 276 } 292 277 -
trunk/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.h
r200315 r221046 82 82 MediaTime durationMediaTime() const override; 83 83 void seekWithTolerance(const MediaTime&, const MediaTime&, const MediaTime&) override; 84 unsigned long totalVideoFrames() override; 85 unsigned long droppedVideoFrames() override; 86 unsigned long corruptedVideoFrames() override; 87 MediaTime totalFrameDelay() override; 84 std::optional<PlatformVideoPlaybackQualityMetrics> videoPlaybackQualityMetrics() override; 88 85 89 86 MediaPlayer* m_player; -
trunk/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.cpp
r217905 r221046 184 184 } 185 185 186 std::optional<PlatformVideoPlaybackQualityMetrics> MockMediaSourcePrivate::videoPlaybackQualityMetrics() 187 { 188 return PlatformVideoPlaybackQualityMetrics( 189 m_totalVideoFrames, 190 m_droppedVideoFrames, 191 m_corruptedVideoFrames, 192 m_totalFrameDelay.toDouble() 193 ); 194 } 195 186 196 }; 187 197 -
trunk/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.h
r197563 r221046 56 56 MediaTime seekToTime(const MediaTime&, const MediaTime& negativeThreshold, const MediaTime& positiveThreshold); 57 57 58 unsigned long totalVideoFrames() const { return m_totalVideoFrames; } 59 unsigned long droppedVideoFrames() const { return m_droppedVideoFrames; } 60 unsigned long corruptedVideoFrames() const { return m_corruptedVideoFrames; } 61 MediaTime totalFrameDelay() const { return m_totalFrameDelay; } 58 std::optional<PlatformVideoPlaybackQualityMetrics> videoPlaybackQualityMetrics(); 62 59 63 60 void incrementTotalVideoFrames() { ++m_totalVideoFrames; }
Note: See TracChangeset
for help on using the changeset viewer.