Changeset 190020 in webkit
- Timestamp:
- Sep 19, 2015, 5:43:08 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r190017 r190020 1 2015-09-19 Eric Carlson <eric.carlson@apple.com> 2 3 Cleanup code that finds and loads a media engine 4 https://bugs.webkit.org/show_bug.cgi?id=149371 5 6 Reviewed by Darin Adler. 7 8 No new tests, no functional change. 9 10 * Modules/mediastream/MediaStream.cpp: 11 (WebCore::MediaStream::setRegistry): New, set the registry. 12 (WebCore::MediaStream::lookup): New, lookup a url in the registry. 13 * Modules/mediastream/MediaStream.h: 14 15 * html/HTMLMediaElement.cpp: 16 (WebCore::HTMLMediaElement::loadResource): Restructure and simplify the code that tries the 17 different types of media engine so the code is easier to understand and modify. 18 (WebCore::HTMLMediaElement::createMediaPlayer): Clear m_mediaStreamSrcObject. 19 20 * platform/graphics/MediaPlayer.cpp: 21 (WebCore::buildMediaEnginesVector): Add some whitespace to make it easier to read. 22 (WebCore::bestMediaEngineForSupportParameters): Also process mediastream and mediasource urls. 23 (WebCore::MediaPlayer::load): ASSERT if called when the reload timer is active. 24 (WebCore::MediaPlayer::loadWithNextMediaEngine): Also process mediastream and mediasource urls. 25 26 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: 27 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::supportsType): Don't test empty/null urls. 28 29 * platform/mock/mediasource/MockMediaPlayerMediaSource.cpp: 30 (WebCore::MockMediaPlayerMediaSource::supportsType): Ditto. 31 1 32 2015-09-19 Chris Dumez <cdumez@apple.com> 2 33 -
trunk/Source/WebCore/Modules/mediastream/MediaStream.cpp
r186640 r190020 2 2 * Copyright (C) 2011 Google Inc. All rights reserved. 3 3 * Copyright (C) 2011, 2012, 2015 Ericsson AB. All rights reserved. 4 * Copyright (C) 2013 Apple Inc. All rights reserved.4 * Copyright (C) 2013-2015 Apple Inc. All rights reserved. 5 5 * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies). 6 6 * … … 36 36 #include "MediaStreamTrackEvent.h" 37 37 #include "RealtimeMediaSource.h" 38 #include "URL.h" 38 39 #include <wtf/NeverDestroyed.h> 39 40 40 41 namespace WebCore { 42 43 static URLRegistry* s_registry; 44 45 void MediaStream::setRegistry(URLRegistry& registry) 46 { 47 ASSERT(!s_registry); 48 s_registry = ®istry; 49 } 50 51 MediaStream* MediaStream::lookUp(const URL& url) 52 { 53 if (!s_registry) 54 return nullptr; 55 56 return static_cast<MediaStream*>(s_registry->lookup(url.string())); 57 } 41 58 42 59 Ref<MediaStream> MediaStream::create(ScriptExecutionContext& context) -
trunk/Source/WebCore/Modules/mediastream/MediaStream.h
r187164 r190020 2 2 * Copyright (C) 2011 Google Inc. All rights reserved. 3 3 * Copyright (C) 2011, 2015 Ericsson AB. All rights reserved. 4 * Copyright (C) 2013 Apple Inc. All rights reserved.4 * Copyright (C) 2013-2015 Apple Inc. All rights reserved. 5 5 * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies). 6 6 * … … 52 52 virtual void didAddOrRemoveTrack() = 0; 53 53 }; 54 55 static void setRegistry(URLRegistry&); 56 static MediaStream* lookUp(const URL&); 54 57 55 58 static Ref<MediaStream> create(ScriptExecutionContext&); -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r189565 r190020 1268 1268 LOG(Media, "HTMLMediaElement::loadResource(%p) - m_currentSrc -> %s", this, urlForLoggingMedia(m_currentSrc).utf8().data()); 1269 1269 1270 #if ENABLE(MEDIA_STREAM) 1271 if (MediaStreamRegistry::registry().lookup(url.string())) 1272 m_mediaSession->removeBehaviorRestriction(MediaElementSession::RequireUserGestureForRateChange); 1273 #endif 1274 1275 if (m_sendProgressEvents) 1270 if (m_sendProgressEvents) 1276 1271 startProgressEventTimer(); 1277 1272 … … 1293 1288 updateVolume(); 1294 1289 1290 bool loadAttempted = false; 1295 1291 #if ENABLE(MEDIA_SOURCE) 1296 1292 ASSERT(!m_mediaSource); … … 1308 1304 mediaLoadingFailed(MediaPlayer::FormatError); 1309 1305 } 1310 } else 1311 #endif 1306 loadAttempted = true; 1307 } 1308 #endif 1309 1312 1310 #if ENABLE(MEDIA_STREAM) 1313 if (m_mediaStreamSrcObject) 1314 m_player->load(m_mediaStreamSrcObject->privateStream()); 1315 else 1316 #endif 1317 if (!m_player->load(url, contentType, keySystem)) 1311 if (!loadAttempted) { 1312 if (!m_mediaStreamSrcObject && url.protocolIs(mediaStreamBlobProtocol)) 1313 m_mediaStreamSrcObject = MediaStream::lookUp(url); 1314 1315 if (m_mediaStreamSrcObject) { 1316 loadAttempted = true; 1317 if (!m_player->load(m_mediaStreamSrcObject->privateStream())) 1318 mediaLoadingFailed(MediaPlayer::FormatError); 1319 } 1320 } 1321 #endif 1322 1323 if (!loadAttempted && !m_player->load(url, contentType, keySystem)) 1318 1324 mediaLoadingFailed(MediaPlayer::FormatError); 1319 1325 … … 5651 5657 #endif 5652 5658 5659 #if ENABLE(MEDIA_STREAM) 5660 m_mediaStreamSrcObject = nullptr; 5661 #endif 5662 5653 5663 #if ENABLE(VIDEO_TRACK) 5654 5664 forgetResourceSpecificTracks(); -
trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp
r189144 r190020 1 1 /* 2 * Copyright (C) 2007-201 4Apple Inc. All rights reserved.2 * Copyright (C) 2007-2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 64 64 #if PLATFORM(COCOA) 65 65 #include "MediaPlayerPrivateQTKit.h" 66 66 67 #if USE(AVFOUNDATION) 67 68 #include "MediaPlayerPrivateAVFoundationObjC.h" 68 #if ENABLE(MEDIA_SOURCE) 69 #endif 70 71 #if ENABLE(MEDIA_SOURCE) && USE(AVFOUNDATION) 69 72 #include "MediaPlayerPrivateMediaSourceAVFObjC.h" 70 73 #endif 71 #endif 72 #elif PLATFORM(WIN) && !USE(GSTREAMER) 73 #if USE(AVFOUNDATION) 74 75 #endif // PLATFORM(COCOA) 76 77 #if PLATFORM(WIN) && USE(AVFOUNDATION) && !USE(GSTREAMER) 74 78 #include "MediaPlayerPrivateAVFoundationCF.h" 75 #endif // USE(AVFOUNDATION)76 79 #endif 77 80 … … 179 182 #if USE(AVFOUNDATION) 180 183 if (Settings::isAVFoundationEnabled()) { 184 181 185 #if PLATFORM(COCOA) 182 186 MediaPlayerPrivateAVFoundationObjC::registerMediaEngine(addMediaEngine); 187 #endif 188 183 189 #if ENABLE(MEDIA_SOURCE) 184 190 MediaPlayerPrivateMediaSourceAVFObjC::registerMediaEngine(addMediaEngine); 185 191 #endif 186 #elif PLATFORM(WIN) 192 193 #if PLATFORM(WIN) 187 194 MediaPlayerPrivateAVFoundationCF::registerMediaEngine(addMediaEngine); 188 195 #endif 189 196 } 190 #endif 197 #endif // USE(AVFOUNDATION) 191 198 192 199 #if PLATFORM(MAC) … … 239 246 static const MediaPlayerFactory* bestMediaEngineForSupportParameters(const MediaEngineSupportParameters& parameters, const MediaPlayerFactory* current = nullptr) 240 247 { 241 if (parameters.type.isEmpty() )248 if (parameters.type.isEmpty() && !parameters.isMediaSource && !parameters.isMediaStream) 242 249 return nullptr; 243 250 … … 308 315 bool MediaPlayer::load(const URL& url, const ContentType& contentType, const String& keySystem) 309 316 { 317 ASSERT(!m_reloadTimer.isActive()); 318 310 319 m_contentMIMEType = contentType.type().lower(); 311 320 m_contentTypeCodecs = contentType.parameter(codecs()); … … 346 355 bool MediaPlayer::load(const URL& url, const ContentType& contentType, MediaSourcePrivateClient* mediaSource) 347 356 { 357 ASSERT(!m_reloadTimer.isActive()); 348 358 ASSERT(mediaSource); 359 349 360 m_mediaSource = mediaSource; 350 361 m_contentMIMEType = contentType.type().lower(); … … 361 372 bool MediaPlayer::load(MediaStreamPrivate* mediaStream) 362 373 { 374 ASSERT(!m_reloadTimer.isActive()); 363 375 ASSERT(mediaStream); 376 364 377 m_mediaStream = mediaStream; 365 378 m_keySystem = ""; … … 392 405 void MediaPlayer::loadWithNextMediaEngine(const MediaPlayerFactory* current) 393 406 { 407 #if ENABLE(MEDIA_SOURCE) 408 #define MEDIASOURCE m_mediaSource 409 #else 410 #define MEDIASOURCE 0 411 #endif 412 413 #if ENABLE(MEDIA_STREAM) 414 #define MEDIASTREAM m_mediaStream 415 #else 416 #define MEDIASTREAM 0 417 #endif 418 394 419 const MediaPlayerFactory* engine = nullptr; 395 420 396 if (!m_contentMIMEType.isEmpty() )421 if (!m_contentMIMEType.isEmpty() || MEDIASTREAM || MEDIASOURCE) 397 422 engine = nextBestMediaEngine(current); 398 423 -
trunk/Source/WebCore/platform/graphics/MediaPlayer.h
r189144 r190020 104 104 105 105 struct MediaEngineSupportParameters { 106 107 MediaEngineSupportParameters() { } 108 106 109 String type; 107 110 String codecs; 108 111 URL url; 109 #if ENABLE(ENCRYPTED_MEDIA)110 112 String keySystem; 111 #endif 112 #if ENABLE(MEDIA_SOURCE) 113 bool isMediaSource; 114 #endif 115 #if ENABLE(MEDIA_STREAM) 116 bool isMediaStream; 117 #endif 118 119 MediaEngineSupportParameters() 120 #if ENABLE(MEDIA_SOURCE) 121 : isMediaSource(false) 122 #endif 123 { 124 #if ENABLE(MEDIA_STREAM) 125 isMediaStream = false; 126 #endif 127 } 113 bool isMediaSource { false }; 114 bool isMediaStream { false }; 128 115 }; 129 116 -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm
r189144 r190020 241 241 return MediaPlayer::IsNotSupported; 242 242 #endif 243 if (!mimeTypeCache().contains(parameters.type)) 243 244 if (parameters.type.isEmpty() || !mimeTypeCache().contains(parameters.type)) 244 245 return MediaPlayer::IsNotSupported; 245 246 -
trunk/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp
r189144 r190020 1 1 /* 2 * Copyright (C) 2013 Apple Inc. All rights reserved.2 * Copyright (C) 2013-2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 70 70 return MediaPlayer::IsNotSupported; 71 71 72 if ( !mimeTypeCache().contains(parameters.type))72 if (parameters.type.isEmpty() || !mimeTypeCache().contains(parameters.type)) 73 73 return MediaPlayer::IsNotSupported; 74 74
Note:
See TracChangeset
for help on using the changeset viewer.