Changeset 256060 in webkit
- Timestamp:
- Feb 7, 2020 2:07:37 PM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r256051 r256060 1 2020-02-07 Eric Carlson <eric.carlson@apple.com> 2 3 Captions sometimes render at the wrong size when in fullscreen and PiP 4 https://bugs.webkit.org/show_bug.cgi?id=207389 5 <rdar://problem/58677864> 6 7 Reviewed by Jer Noble. 8 9 The TextTrackRepresentation, used to render captions when in fullscreen and PiP on 10 iOS and and in PiP on macOS, frequently rendered captions before layout completed 11 immediately after it was created. Fix this by having it not render until a layout 12 happens. Additionally, make the code more efficient by hiding the TextTrackRepresentation's 13 backing layer when cues are not visible instead of destroying the whole object. 14 Drive by: RELEASE_LOG_DISABLED is always defined for PLATFORM(COCOA), so remove it 15 from the macOS/iOS media players to make it easier to add logging to VideoFullscreenLayerManagerObjC. 16 17 18 * html/HTMLMediaElement.cpp: 19 (WebCore::convertEnumerationToString): 20 (WebCore::HTMLMediaElement::configureTextTrackDisplay): 21 * html/HTMLMediaElementEnums.h: 22 (WTF::LogArgument<WebCore::HTMLMediaElementEnums::TextTrackVisibilityCheckType>::toString): 23 * html/shadow/MediaControlElements.cpp: 24 (WebCore::MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement): 25 (WebCore::MediaControlTextTrackContainerElement::updateDisplay): 26 (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentation): 27 (WebCore::MediaControlTextTrackContainerElement::clearTextTrackRepresentation): 28 (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentationStyle): 29 (WebCore::MediaControlTextTrackContainerElement::layoutIfNecessary): 30 (WebCore::MediaControlTextTrackContainerElement::updateVideoDisplaySize): 31 (WebCore::MediaControlTextTrackContainerElement::updateSizes): 32 (WebCore::MediaControlTextTrackContainerElement::updateCueStyles): 33 (WebCore::MediaControlTextTrackContainerElement::logger const): 34 (WebCore::MediaControlTextTrackContainerElement::logIdentifier const): 35 (WebCore::MediaControlTextTrackContainerElement::updateTimerFired): Deleted. 36 (WebCore::MediaControlTextTrackContainerElement::updateStyleForTextTrackRepresentation): Deleted. 37 * platform/graphics/TextTrackRepresentation.h: 38 * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: 39 (WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation): 40 (WebCore::MediaPlayerPrivateAVFoundation::logChannel const): 41 * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: 42 * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: 43 (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC): 44 (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenFrame): 45 (WebCore::MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect): 46 (WebCore::MediaPlayerPrivateAVFoundationObjC::updateAudioTracks): 47 (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoTracks): 48 (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage): 49 (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]): 50 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: 51 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::mediaPlayerLogger): 52 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: 53 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC): 54 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::logChannel const): 55 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: 56 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: 57 (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC): 58 (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::logChannel const): 59 * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h: 60 * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm: 61 (WebCore::VideoFullscreenLayerManagerObjC::VideoFullscreenLayerManagerObjC): 62 (WebCore::VideoFullscreenLayerManagerObjC::setVideoLayer): 63 (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer): 64 (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenFrame): 65 (WebCore::VideoFullscreenLayerManagerObjC::didDestroyVideoLayer): 66 (WebCore::VideoFullscreenLayerManagerObjC::syncTextTrackBounds): 67 (WebCore::VideoFullscreenLayerManagerObjC::setTextTrackRepresentation): 68 (WebCore::VideoFullscreenLayerManagerObjC::logChannel const): 69 * platform/graphics/cocoa/TextTrackRepresentationCocoa.h: 70 * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm: 71 (-[WebCoreTextTrackRepresentationCocoaHelper observeValueForKeyPath:ofObject:change:context:]): 72 (TextTrackRepresentationCocoa::setHidden const): 73 (TextTrackRepresentationCocoa::boundsChanged): 74 * rendering/RenderMediaControlElements.cpp: 75 (WebCore::RenderTextTrackContainerElement::layout): 76 1 77 2020-02-07 Sam Weinig <weinig@apple.com> 2 78 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r255191 r256060 275 275 } 276 276 277 String convertEnumerationToString(HTMLMediaElement::TextTrackVisibilityCheckType enumerationValue) 278 { 279 static const NeverDestroyed<String> values[] = { 280 MAKE_STATIC_STRING_IMPL("CheckTextTrackVisibility"), 281 MAKE_STATIC_STRING_IMPL("AssumeTextTrackVisibilityChanged"), 282 }; 283 static_assert(static_cast<size_t>(HTMLMediaElement::TextTrackVisibilityCheckType::CheckTextTrackVisibility) == 0, "TextTrackVisibilityCheckType::CheckTextTrackVisibility is not 0 as expected"); 284 static_assert(static_cast<size_t>(HTMLMediaElement::TextTrackVisibilityCheckType::AssumeTextTrackVisibilityChanged) == 1, "TextTrackVisibilityCheckType::AssumeTextTrackVisibilityChanged is not 1 as expected"); 285 ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values)); 286 return values[static_cast<size_t>(enumerationValue)]; 287 } 288 277 289 #if ENABLE(VIDEO_TRACK) 278 290 … … 6535 6547 void HTMLMediaElement::configureTextTrackDisplay(TextTrackVisibilityCheckType checkType) 6536 6548 { 6537 ALWAYS_LOG(LOGIDENTIFIER );6549 ALWAYS_LOG(LOGIDENTIFIER, checkType); 6538 6550 ASSERT(m_textTracks); 6539 6551 -
trunk/Source/WebCore/html/HTMLMediaElementEnums.h
r237207 r256060 48 48 String convertEnumerationToString(HTMLMediaElementEnums::ReadyState); 49 49 String convertEnumerationToString(HTMLMediaElementEnums::NetworkState); 50 String convertEnumerationToString(HTMLMediaElementEnums::TextTrackVisibilityCheckType); 50 51 51 52 } // namespace WebCore … … 72 73 }; 73 74 75 template <> 76 struct LogArgument<WebCore::HTMLMediaElementEnums::TextTrackVisibilityCheckType> { 77 static String toString(const WebCore::HTMLMediaElementEnums::TextTrackVisibilityCheckType type) 78 { 79 return convertEnumerationToString(type); 80 } 81 }; 82 74 83 }; // namespace WTF 75 84 -
trunk/Source/WebCore/html/shadow/MediaControlElements.cpp
r254893 r256060 1094 1094 MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement(Document& document) 1095 1095 : MediaControlDivElement(document, MediaTextTrackDisplayContainer) 1096 , m_updateTimer(*this, &MediaControlTextTrackContainerElement::updateTimerFired)1097 , m_fontSize(0)1098 , m_fontSizeIsImportant(false)1099 , m_updateTextTrackRepresentationStyle(false)1100 1096 { 1101 1097 setPseudo(AtomString("-webkit-media-text-track-container", AtomString::ConstructFromLiteral)); … … 1206 1202 1207 1203 // 11. Return output. 1208 if (hasChildNodes()) {1204 if (hasChildNodes()) 1209 1205 show(); 1206 else 1207 hide(); 1208 1209 if (m_textTrackRepresentation || video.requiresTextTrackRepresentation()) 1210 1210 updateTextTrackRepresentation(); 1211 } else {1212 hide();1213 clearTextTrackRepresentation();1214 }1215 1211 } 1216 1212 … … 1294 1290 } 1295 1291 1296 void MediaControlTextTrackContainerElement::updateTimerFired() 1297 { 1298 if (!document().page()) 1299 return; 1300 1292 void MediaControlTextTrackContainerElement::updateTextTrackRepresentation() 1293 { 1301 1294 auto mediaElement = parentMediaElement(this); 1302 1295 if (!mediaElement) 1303 1296 return; 1304 1297 1305 for (auto& activeCue : mediaElement->currentlyActiveCues()) 1306 activeCue.data()->recalculateStyles(); 1307 1308 if (m_textTrackRepresentation) 1309 updateStyleForTextTrackRepresentation(); 1310 1311 updateActiveCuesFontSize(); 1312 updateDisplay(); 1313 updateTextStrokeStyle(); 1314 } 1315 1316 void MediaControlTextTrackContainerElement::updateTextTrackRepresentation() 1317 { 1318 auto mediaElement = parentMediaElement(this); 1319 if (!mediaElement) 1320 return; 1321 1322 if (!mediaElement->requiresTextTrackRepresentation()) { 1298 auto requiresTextTrackRepresentation = mediaElement->requiresTextTrackRepresentation(); 1299 if (!hasChildNodes() || !requiresTextTrackRepresentation) { 1323 1300 if (m_textTrackRepresentation) { 1324 clearTextTrackRepresentation(); 1325 updateSizes(ForceUpdate::Yes); 1301 if (!requiresTextTrackRepresentation) { 1302 clearTextTrackRepresentation(); 1303 updateSizes(ForceUpdate::Yes); 1304 } else 1305 m_textTrackRepresentation->setHidden(true); 1326 1306 } 1327 1307 return; … … 1329 1309 1330 1310 if (!m_textTrackRepresentation) { 1311 ALWAYS_LOG(LOGIDENTIFIER); 1312 1313 m_waitingForFirstLayout = true; 1331 1314 m_textTrackRepresentation = TextTrackRepresentation::create(*this); 1332 1315 if (document().page()) 1333 1316 m_textTrackRepresentation->setContentScale(document().page()->deviceScaleFactor()); 1334 m_updateTextTrackRepresentationStyle = true;1335 1317 mediaElement->setTextTrackRepresentation(m_textTrackRepresentation.get()); 1336 } 1337 1338 m_textTrackRepresentation->update(); 1339 updateStyleForTextTrackRepresentation(); 1318 updateSizes(); 1319 updateTextTrackRepresentationStyle(); 1320 } 1321 1322 m_textTrackRepresentation->setHidden(false); 1323 if (!m_waitingForFirstLayout) 1324 m_textTrackRepresentation->update(); 1340 1325 } 1341 1326 … … 1345 1330 return; 1346 1331 1332 ALWAYS_LOG(LOGIDENTIFIER); 1333 1334 m_waitingForFirstLayout = true; 1347 1335 m_textTrackRepresentation = nullptr; 1348 m_updateTextTrackRepresentationStyle = true;1349 1336 if (auto mediaElement = parentMediaElement(this)) 1350 1337 mediaElement->setTextTrackRepresentation(nullptr); 1351 update StyleForTextTrackRepresentation();1338 updateTextTrackRepresentationStyle(); 1352 1339 updateActiveCuesFontSize(); 1353 1340 } 1354 1341 1355 void MediaControlTextTrackContainerElement::updateStyleForTextTrackRepresentation() 1356 { 1357 if (!m_updateTextTrackRepresentationStyle) 1358 return; 1359 1360 m_updateTextTrackRepresentationStyle = false; 1361 1342 void MediaControlTextTrackContainerElement::updateTextTrackRepresentationStyle() 1343 { 1362 1344 if (m_textTrackRepresentation) { 1363 1345 setInlineStyleProperty(CSSPropertyWidth, m_videoDisplaySize.size().width(), CSSUnitType::CSS_PX); … … 1389 1371 } 1390 1372 1391 void MediaControlTextTrackContainerElement::updateSizes(ForceUpdate force) 1392 { 1373 void MediaControlTextTrackContainerElement::layoutIfNecessary() 1374 { 1375 m_waitingForFirstLayout = false; 1376 1377 auto sizeChanged = updateVideoDisplaySize(); 1378 if (m_textTrackRepresentation) 1379 m_textTrackRepresentation->update(); 1380 1381 if (!sizeChanged) 1382 return; 1383 1384 // FIXME (121170): This function is called during layout, and should lay out the text tracks immediately. 1385 m_taskQueue.enqueueTask([this] () { 1386 updateCueStyles(); 1387 }); 1388 } 1389 1390 bool MediaControlTextTrackContainerElement::updateVideoDisplaySize() 1391 { 1392 if (!document().page()) 1393 return false; 1394 1393 1395 auto mediaElement = parentMediaElement(this); 1394 1396 if (!mediaElement) 1395 return; 1396 1397 if (!document().page()) 1398 return; 1397 return false; 1399 1398 1400 1399 IntRect videoBox; … … 1406 1405 } else { 1407 1406 if (!is<RenderVideo>(mediaElement->renderer())) 1408 return ;1407 return false; 1409 1408 videoBox = downcast<RenderVideo>(*mediaElement->renderer()).videoBox(); 1410 1409 } 1411 1410 1412 if ( force == ForceUpdate::No &&m_videoDisplaySize == videoBox)1413 return ;1411 if (m_videoDisplaySize == videoBox) 1412 return false; 1414 1413 1415 1414 m_videoDisplaySize = videoBox; 1416 m_updateTextTrackRepresentationStyle = true; 1415 updateTextTrackRepresentationStyle(); 1416 1417 return true; 1418 } 1419 1420 void MediaControlTextTrackContainerElement::updateSizes(ForceUpdate force) 1421 { 1422 if (updateVideoDisplaySize() || force == ForceUpdate::Yes) 1423 updateCueStyles(); 1424 } 1425 1426 void MediaControlTextTrackContainerElement::updateCueStyles() 1427 { 1428 if (!document().page()) 1429 return; 1430 1431 auto mediaElement = parentMediaElement(this); 1432 if (!mediaElement) 1433 return; 1434 1417 1435 mediaElement->syncTextTrackBounds(); 1418 1436 1419 // FIXME (121170): This function is called during layout, and should lay out the text tracks immediately. 1420 m_updateTimer.startOneShot(0_s); 1437 for (auto& activeCue : mediaElement->currentlyActiveCues()) 1438 activeCue.data()->recalculateStyles(); 1439 1440 updateActiveCuesFontSize(); 1441 updateDisplay(); 1442 updateTextStrokeStyle(); 1421 1443 } 1422 1444 … … 1467 1489 const Logger& MediaControlTextTrackContainerElement::logger() const 1468 1490 { 1469 return document().logger(); 1491 if (!m_logger) 1492 m_logger = &document().logger(); 1493 1494 return *m_logger; 1470 1495 } 1471 1496 1472 1497 const void* MediaControlTextTrackContainerElement::logIdentifier() const 1473 1498 { 1474 if (auto mediaElement = parentMediaElement(this)) 1475 return mediaElement->logIdentifier(); 1476 return nullptr; 1499 if (!m_logIdentifier) { 1500 if (auto mediaElement = parentMediaElement(this)) 1501 m_logIdentifier = mediaElement->logIdentifier(); 1502 } 1503 1504 return m_logIdentifier; 1477 1505 } 1478 1506 -
trunk/Source/WebCore/html/shadow/MediaControlElements.h
r251950 r256060 32 32 #if ENABLE(VIDEO) 33 33 34 #include "GenericTaskQueue.h" 34 35 #include "MediaControlElementTypes.h" 35 36 #include "TextTrackRepresentation.h" … … 483 484 enum class ForceUpdate { Yes, No }; 484 485 void updateSizes(ForceUpdate force = ForceUpdate::No); 486 void layoutIfNecessary(); 485 487 486 488 void updateDisplay(); … … 489 491 490 492 private: 491 void updateTimerFired(); 493 explicit MediaControlTextTrackContainerElement(Document&); 494 495 bool updateVideoDisplaySize(); 496 void updateCueStyles(); 492 497 void updateActiveCuesFontSize(); 493 498 void updateTextStrokeStyle(); 494 499 void processActiveVTTCue(VTTCue&); 500 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override; 501 502 RefPtr<Image> createTextTrackRepresentationImage() override; 503 void textTrackRepresentationBoundsChanged(const IntRect&) override; 504 void updateTextTrackRepresentation(); 505 void clearTextTrackRepresentation(); 506 void updateTextTrackRepresentationStyle(); 495 507 496 508 #if !RELEASE_LOG_DISABLED … … 499 511 WTFLogChannel& logChannel() const final; 500 512 const char* logClassName() const final { return "MediaControlTextTrackContainerElement"; } 501 #endif 502 503 explicit MediaControlTextTrackContainerElement(Document&); 504 505 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override; 506 507 RefPtr<Image> createTextTrackRepresentationImage() override; 508 void textTrackRepresentationBoundsChanged(const IntRect&) override; 509 void updateTextTrackRepresentation(); 510 void clearTextTrackRepresentation(); 511 void updateStyleForTextTrackRepresentation(); 513 mutable RefPtr<Logger> m_logger; 514 mutable const void* m_logIdentifier { nullptr }; 515 #endif 516 512 517 std::unique_ptr<TextTrackRepresentation> m_textTrackRepresentation; 513 518 514 Timer m_updateTimer;519 GenericTaskQueue<Timer> m_taskQueue; 515 520 IntRect m_videoDisplaySize; 516 int m_fontSize ;517 bool m_fontSizeIsImportant ;518 bool m_ updateTextTrackRepresentationStyle;521 int m_fontSize { 0 }; 522 bool m_fontSizeIsImportant { false }; 523 bool m_waitingForFirstLayout { true }; 519 524 }; 520 525 -
trunk/Source/WebCore/platform/graphics/TextTrackRepresentation.cpp
r248846 r256060 37 37 public: 38 38 virtual ~NullTextTrackRepresentation() = default; 39 void update() override { } 40 PlatformLayer* platformLayer() override { return nullptr; } 41 void setContentScale(float) override { } 42 IntRect bounds() const override { return IntRect(); } 39 void update() final { } 40 PlatformLayer* platformLayer() final { return nullptr; } 41 void setContentScale(float) final { } 42 IntRect bounds() const final { return IntRect(); } 43 void setHidden(bool) const final { } 43 44 }; 44 45 -
trunk/Source/WebCore/platform/graphics/TextTrackRepresentation.h
r241183 r256060 56 56 virtual void setContentScale(float) = 0; 57 57 virtual IntRect bounds() const = 0; 58 virtual void setHidden(bool) const = 0; 58 59 }; 59 60 -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
r255581 r256060 405 405 MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC(MediaPlayer* player) 406 406 : MediaPlayerPrivateAVFoundation(player) 407 , m_videoFullscreenLayerManager(makeUnique<VideoFullscreenLayerManagerObjC>( ))407 , m_videoFullscreenLayerManager(makeUnique<VideoFullscreenLayerManagerObjC>(logger(), logIdentifier())) 408 408 , m_videoFullscreenGravity(MediaPlayer::VideoGravity::ResizeAspect) 409 409 , m_objcObserver(adoptNS([[WebCoreAVFMovieObserver alloc] initWithPlayer:makeWeakPtr(*this)])) … … 1092 1092 void MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenFrame(FloatRect frame) 1093 1093 { 1094 ALWAYS_LOG(LOGIDENTIFIER, "width = ", frame.size().width(), ", height = ", frame.size().height()); 1094 1095 m_videoFullscreenLayerManager->setVideoFullscreenFrame(frame); 1095 1096 } … … 1559 1560 ASSERT(m_imageGenerator); 1560 1561 1561 #if !RELEASE_LOG_DISABLED1562 1562 MonotonicTime start = MonotonicTime::now(); 1563 #endif1564 1563 1565 1564 [m_imageGenerator.get() setMaximumSize:CGSize(rect.size())]; … … 1567 1566 RetainPtr<CGImageRef> image = adoptCF(CGImageCreateCopyWithColorSpace(rawImage.get(), sRGBColorSpaceRef())); 1568 1567 1569 #if !RELEASE_LOG_DISABLED1570 1568 INFO_LOG(LOGIDENTIFIER, "creating image took ", (MonotonicTime::now() - start).seconds()); 1571 #endif1572 1569 1573 1570 return image; … … 2016 2013 void MediaPlayerPrivateAVFoundationObjC::updateAudioTracks() 2017 2014 { 2018 #if !RELEASE_LOG_DISABLED2019 2015 size_t count = m_audioTracks.size(); 2020 #endif2021 2016 2022 2017 Vector<String> characteristics = player()->preferredAudioCharacteristics(); … … 2034 2029 track->resetPropertiesFromTrack(); 2035 2030 2036 #if !RELEASE_LOG_DISABLED2037 2031 ALWAYS_LOG(LOGIDENTIFIER, "track count was ", count, ", is ", m_audioTracks.size()); 2038 #endif2039 2032 } 2040 2033 2041 2034 void MediaPlayerPrivateAVFoundationObjC::updateVideoTracks() 2042 2035 { 2043 #if !RELEASE_LOG_DISABLED2044 2036 size_t count = m_videoTracks.size(); 2045 #endif2046 2037 2047 2038 determineChangedTracksFromNewTracksAndOldItems(m_cachedTracks.get(), AVMediaTypeVideo, m_videoTracks, &VideoTrackPrivateAVFObjC::create, player(), &MediaPlayer::removeVideoTrack, &MediaPlayer::addVideoTrack); … … 2058 2049 track->resetPropertiesFromTrack(); 2059 2050 2060 #if !RELEASE_LOG_DISABLED2061 2051 ALWAYS_LOG(LOGIDENTIFIER, "track count was ", count, ", is ", m_videoTracks.size()); 2062 #endif2063 2052 } 2064 2053 … … 2229 2218 } 2230 2219 2231 #if !RELEASE_LOG_DISABLED2232 2220 MonotonicTime start = MonotonicTime::now(); 2233 #endif2234 2221 2235 2222 m_lastImage = m_pixelBufferConformer->createImageFromPixelBuffer(m_lastPixelBuffer.get()); 2236 2223 2237 #if !RELEASE_LOG_DISABLED2238 2224 INFO_LOG(LOGIDENTIFIER, "creating buffer took ", (MonotonicTime::now() - start).seconds()); 2239 #endif2240 2225 #endif // HAVE(CORE_VIDEO) 2241 2226 } … … 3451 3436 } 3452 3437 3453 #if !RELEASE_LOG_DISABLED3454 3438 if (player->logger().willLog(player->logChannel(), WTFLogLevel::Debug) && !([keyPath isEqualToString:@"loadedTimeRanges"] || [keyPath isEqualToString:@"seekableTimeRanges"])) { 3455 3439 auto identifier = Logger::LogSiteIdentifier("MediaPlayerPrivateAVFoundation", "observeValueForKeyPath", player->logIdentifier()); … … 3465 3449 player->logger().debug(player->logChannel(), identifier, willChange ? "will" : "did", " change '", [keyPath UTF8String], "'"); 3466 3450 } 3467 #endif3468 3451 }); 3469 3452 }); -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h
r254214 r256060 64 64 : public CanMakeWeakPtr<MediaPlayerPrivateMediaSourceAVFObjC> 65 65 , public MediaPlayerPrivateInterface 66 #if !RELEASE_LOG_DISABLED67 66 , private LoggerHelper 68 #endif69 67 { 70 68 public: … … 151 149 bool shouldCheckHardwareSupport() const; 152 150 153 #if !RELEASE_LOG_DISABLED154 151 const Logger& logger() const final { return m_logger.get(); } 155 152 const char* logClassName() const override { return "MediaPlayerPrivateMediaSourceAVFObjC"; } … … 159 156 const void* mediaPlayerLogIdentifier() { return logIdentifier(); } 160 157 const Logger& mediaPlayerLogger() { return logger(); } 161 #endif162 158 163 159 enum SeekState { … … 328 324 bool m_shouldPlayToTarget { false }; 329 325 #endif 330 std::unique_ptr<VideoFullscreenLayerManagerObjC> m_videoFullscreenLayerManager;331 332 Ref<EffectiveRateChangedListener> m_effectiveRateChangedListener;333 334 #if !RELEASE_LOG_DISABLED335 326 Ref<const Logger> m_logger; 336 327 const void* m_logIdentifier; 337 #endif 328 std::unique_ptr<VideoFullscreenLayerManagerObjC> m_videoFullscreenLayerManager; 329 330 Ref<EffectiveRateChangedListener> m_effectiveRateChangedListener; 338 331 }; 339 332 -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm
r254964 r256060 138 138 , m_seeking(false) 139 139 , m_loadingProgressed(false) 140 , m_videoFullscreenLayerManager(makeUnique<VideoFullscreenLayerManagerObjC>())141 , m_effectiveRateChangedListener(EffectiveRateChangedListener::create(*this, [m_synchronizer timebase]))142 #if !RELEASE_LOG_DISABLED143 140 , m_logger(player->mediaPlayerLogger()) 144 141 , m_logIdentifier(player->mediaPlayerLogIdentifier()) 145 #endif 142 , m_videoFullscreenLayerManager(makeUnique<VideoFullscreenLayerManagerObjC>(m_logger, m_logIdentifier)) 143 , m_effectiveRateChangedListener(EffectiveRateChangedListener::create(*this, [m_synchronizer timebase])) 146 144 { 147 145 auto logSiteIdentifier = LOGIDENTIFIER; … … 1222 1220 } 1223 1221 1224 #if !RELEASE_LOG_DISABLED1225 1222 WTFLogChannel& MediaPlayerPrivateMediaSourceAVFObjC::logChannel() const 1226 1223 { 1227 1224 return LogMediaSource; 1228 1225 } 1226 1227 } 1228 1229 1229 #endif 1230 1231 }1232 1233 #endif -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h
r254817 r256060 53 53 54 54 class MediaPlayerPrivateMediaStreamAVFObjC final : public MediaPlayerPrivateInterface, private MediaStreamPrivate::Observer, private MediaStreamTrackPrivate::Observer, public SampleBufferDisplayLayer::Client 55 #if !RELEASE_LOG_DISABLED56 55 , private LoggerHelper 57 #endif58 56 { 59 57 public: … … 76 74 void destroyLayers(); 77 75 78 #if !RELEASE_LOG_DISABLED79 76 const Logger& logger() const final { return m_logger.get(); } 80 77 const char* logClassName() const override { return "MediaPlayerPrivateMediaStreamAVFObjC"; } 81 78 const void* logIdentifier() const final { return reinterpret_cast<const void*>(m_logIdentifier); } 82 79 WTFLogChannel& logChannel() const final; 83 #endif84 80 85 81 PlatformLayer* rootLayer() const; … … 244 240 CGAffineTransform m_videoTransform; 245 241 std::unique_ptr<SampleBufferDisplayLayer> m_sampleBufferDisplayLayer; 242 243 Ref<const Logger> m_logger; 244 const void* m_logIdentifier; 246 245 std::unique_ptr<VideoFullscreenLayerManagerObjC> m_videoFullscreenLayerManager; 247 246 248 247 // SampleBufferDisplayLayer::Client 249 248 void sampleBufferDisplayLayerStatusDidChange(SampleBufferDisplayLayer&) final; 250 251 #if !RELEASE_LOG_DISABLED252 Ref<const Logger> m_logger;253 const void* m_logIdentifier;254 #endif255 249 256 250 RetainPtr<WebRootSampleBufferBoundsChangeListener> m_boundsChangeListener; -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm
r254817 r256060 145 145 : m_player(player) 146 146 , m_clock(PAL::Clock::create()) 147 , m_videoFullscreenLayerManager(makeUnique<VideoFullscreenLayerManagerObjC>())148 #if !RELEASE_LOG_DISABLED149 147 , m_logger(player->mediaPlayerLogger()) 150 148 , m_logIdentifier(player->mediaPlayerLogIdentifier()) 151 #endif 149 , m_videoFullscreenLayerManager(makeUnique<VideoFullscreenLayerManagerObjC>(m_logger, m_logIdentifier)) 152 150 , m_boundsChangeListener(adoptNS([[WebRootSampleBufferBoundsChangeListener alloc] initWithParent:this])) 153 151 { … … 1057 1055 } 1058 1056 1059 #if !RELEASE_LOG_DISABLED1060 1057 WTFLogChannel& MediaPlayerPrivateMediaStreamAVFObjC::logChannel() const 1061 1058 { 1062 1059 return LogMedia; 1063 1060 } 1061 1062 } 1063 1064 1064 #endif 1065 1066 }1067 1068 #endif -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h
r252346 r256060 32 32 #include "WebVideoContainerLayer.h" 33 33 #include <wtf/Function.h> 34 #include <wtf/LoggerHelper.h> 34 35 #include <wtf/Noncopyable.h> 35 36 #include <wtf/RetainPtr.h> … … 39 40 namespace WebCore { 40 41 41 class VideoFullscreenLayerManagerObjC final : public VideoFullscreenLayerManager {42 class VideoFullscreenLayerManagerObjC final : public VideoFullscreenLayerManager , public LoggerHelper { 42 43 WTF_MAKE_FAST_ALLOCATED; 43 44 public: 44 VideoFullscreenLayerManagerObjC( );45 VideoFullscreenLayerManagerObjC(const Logger&, const void*); 45 46 46 47 PlatformLayer *videoInlineLayer() const final { return m_videoInlineLayer.get(); } … … 58 59 59 60 private: 61 const Logger& logger() const final { return m_logger.get(); } 62 const void* logIdentifier() const final { return m_logIdentifier; } 63 const char* logClassName() const final { return "VideoFullscreenLayerManagerObjC"; } 64 WTFLogChannel& logChannel() const final; 65 66 Ref<const Logger> m_logger; 67 const void* m_logIdentifier; 68 60 69 RetainPtr<PlatformLayer> m_textTrackRepresentationLayer; 61 70 RetainPtr<WebVideoContainerLayer> m_videoInlineLayer; -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm
r252346 r256060 28 28 29 29 #import "Color.h" 30 #import "Logging.h" 30 31 #import "TextTrackRepresentation.h" 31 32 #import "WebCoreCALayerExtras.h" … … 40 41 namespace WebCore { 41 42 42 VideoFullscreenLayerManagerObjC::VideoFullscreenLayerManagerObjC( )43 VideoFullscreenLayerManagerObjC::VideoFullscreenLayerManagerObjC(const Logger& logger, const void* logIdentifier) 43 44 : VideoFullscreenLayerManager() 45 , m_logger(logger) 46 , m_logIdentifier(logIdentifier) 44 47 { 45 48 } … … 47 50 void VideoFullscreenLayerManagerObjC::setVideoLayer(PlatformLayer *videoLayer, IntSize contentSize) 48 51 { 52 ALWAYS_LOG(LOGIDENTIFIER, contentSize.width(), ", ", contentSize.height()); 53 49 54 m_videoLayer = videoLayer; 50 55 m_videoInlineFrame = CGRectMake(0, 0, contentSize.width(), contentSize.height()); … … 82 87 } 83 88 89 ALWAYS_LOG(LOGIDENTIFIER); 90 84 91 m_videoFullscreenLayer = videoFullscreenLayer; 85 92 … … 122 129 void VideoFullscreenLayerManagerObjC::setVideoFullscreenFrame(FloatRect videoFullscreenFrame) 123 130 { 131 ALWAYS_LOG(LOGIDENTIFIER, videoFullscreenFrame.x(), ", ", videoFullscreenFrame.y(), ", ", videoFullscreenFrame.width(), ", ", videoFullscreenFrame.height()); 132 124 133 m_videoFullscreenFrame = videoFullscreenFrame; 125 134 if (!m_videoFullscreenLayer) … … 132 141 void VideoFullscreenLayerManagerObjC::didDestroyVideoLayer() 133 142 { 143 ALWAYS_LOG(LOGIDENTIFIER); 144 134 145 [m_videoLayer removeFromSuperlayer]; 135 146 … … 148 159 return; 149 160 161 if (m_textTrackRepresentationLayer.get().bounds == m_videoFullscreenFrame) 162 return; 163 150 164 [CATransaction begin]; 151 165 [CATransaction setDisableActions:YES]; … … 158 172 void VideoFullscreenLayerManagerObjC::setTextTrackRepresentation(TextTrackRepresentation* representation) 159 173 { 174 ALWAYS_LOG(LOGIDENTIFIER); 175 160 176 PlatformLayer* representationLayer = representation ? representation->platformLayer() : nil; 161 177 if (representationLayer == m_textTrackRepresentationLayer) { … … 181 197 } 182 198 183 } 184 199 WTFLogChannel& VideoFullscreenLayerManagerObjC::logChannel() const 200 { 201 return LogMedia; 202 } 203 204 } 205 -
trunk/Source/WebCore/platform/graphics/cocoa/TextTrackRepresentationCocoa.h
r237266 r256060 29 29 #if (PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))) && ENABLE(VIDEO_TRACK) 30 30 31 #import "TextTrackRepresentation.h" 32 #import <QuartzCore/CALayer.h> 33 #import <wtf/RetainPtr.h> 31 #include "GenericTaskQueue.h" 32 #include "TextTrackRepresentation.h" 33 #include <QuartzCore/CALayer.h> 34 #include <wtf/RetainPtr.h> 34 35 35 36 @class WebCoreTextTrackRepresentationCocoaHelper; … … 44 45 TextTrackRepresentationClient& client() const { return m_client; } 45 46 46 PlatformLayer* platformLayer() override { return m_layer.get(); } 47 IntRect bounds() const override; 47 PlatformLayer* platformLayer() final { return m_layer.get(); } 48 49 IntRect bounds() const final; 50 void boundsChanged(); 48 51 49 52 private: 50 void update() override; 51 void setContentScale(float) override; 53 void update() final; 54 void setContentScale(float) final; 55 void setHidden(bool) const final; 52 56 57 GenericTaskQueue<Timer> m_taskQueue; 53 58 TextTrackRepresentationClient& m_client; 54 59 RetainPtr<CALayer> m_layer; -
trunk/Source/WebCore/platform/graphics/cocoa/TextTrackRepresentationCocoa.mm
r248846 r256060 93 93 #else 94 94 if (_parent && [keyPath isEqual:@"bounds"] && object == _parent->platformLayer()) 95 _parent-> client().textTrackRepresentationBoundsChanged(_parent->bounds());95 _parent->boundsChanged(); 96 96 #endif 97 97 } … … 138 138 } 139 139 140 void TextTrackRepresentationCocoa::setHidden(bool hidden) const 141 { 142 [m_layer.get() setHidden:hidden]; 143 } 144 140 145 IntRect TextTrackRepresentationCocoa::bounds() const 141 146 { … … 143 148 } 144 149 150 void TextTrackRepresentationCocoa::boundsChanged() 151 { 152 m_taskQueue.enqueueTask([this] () { 153 client().textTrackRepresentationBoundsChanged(bounds()); 154 }); 155 } 156 145 157 #endif // (PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))) && ENABLE(VIDEO_TRACK) -
trunk/Source/WebCore/rendering/RenderMediaControlElements.cpp
r238963 r256060 105 105 106 106 LayoutStateDisabler layoutStateDisabler(view().frameView().layoutContext()); 107 static_cast<MediaControlTextTrackContainerElement*>(element())-> updateSizes();107 static_cast<MediaControlTextTrackContainerElement*>(element())->layoutIfNecessary(); 108 108 } 109 109
Note: See TracChangeset
for help on using the changeset viewer.