Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: Source/core/html/HTMLMediaElement.cpp

Issue 14619016: Add WebKit prefix to MediaSource,SourceBuffer, and SourceBufferList objects. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | Source/core/html/PublicURLManager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 #include "core/page/Settings.h" 78 #include "core/page/Settings.h"
79 #include "core/platform/ContentType.h" 79 #include "core/platform/ContentType.h"
80 #include "core/platform/Language.h" 80 #include "core/platform/Language.h"
81 #include "core/platform/Logging.h" 81 #include "core/platform/Logging.h"
82 #include "core/platform/MIMETypeFromURL.h" 82 #include "core/platform/MIMETypeFromURL.h"
83 #include "core/platform/MIMETypeRegistry.h" 83 #include "core/platform/MIMETypeRegistry.h"
84 #include "core/platform/graphics/MediaPlayer.h" 84 #include "core/platform/graphics/MediaPlayer.h"
85 #include "core/rendering/RenderLayerCompositor.h" 85 #include "core/rendering/RenderLayerCompositor.h"
86 #include "core/rendering/RenderVideo.h" 86 #include "core/rendering/RenderVideo.h"
87 #include "core/rendering/RenderView.h" 87 #include "core/rendering/RenderView.h"
88 #include "modules/mediasource/MediaSource.h"
89 #include "modules/mediasource/MediaSourceRegistry.h" 88 #include "modules/mediasource/MediaSourceRegistry.h"
89 #include "modules/mediasource/WebKitMediaSource.h"
90 #include "modules/mediastream/MediaStreamRegistry.h" 90 #include "modules/mediastream/MediaStreamRegistry.h"
91 #include "origin/SecurityOrigin.h" 91 #include "origin/SecurityOrigin.h"
92 #include "origin/SecurityPolicy.h" 92 #include "origin/SecurityPolicy.h"
93 93
94 #include "RuntimeEnabledFeatures.h" 94 #include "RuntimeEnabledFeatures.h"
95 #include "core/html/HTMLTrackElement.h" 95 #include "core/html/HTMLTrackElement.h"
96 #include "core/html/track/InbandTextTrack.h" 96 #include "core/html/track/InbandTextTrack.h"
97 #include "core/html/track/TextTrackCueList.h" 97 #include "core/html/track/TextTrackCueList.h"
98 #include "core/html/track/TextTrackList.h" 98 #include "core/html/track/TextTrackList.h"
99 #include "core/page/CaptionUserPreferences.h" 99 #include "core/page/CaptionUserPreferences.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 if (m_textTracks) 289 if (m_textTracks)
290 m_textTracks->clearOwner(); 290 m_textTracks->clearOwner();
291 if (m_textTracks) { 291 if (m_textTracks) {
292 for (unsigned i = 0; i < m_textTracks->length(); ++i) 292 for (unsigned i = 0; i < m_textTracks->length(); ++i)
293 m_textTracks->item(i)->clearClient(); 293 m_textTracks->item(i)->clearClient();
294 } 294 }
295 295
296 if (m_mediaController) 296 if (m_mediaController)
297 m_mediaController->removeMediaElement(this); 297 m_mediaController->removeMediaElement(this);
298 298
299 setSourceState(MediaSource::closedKeyword()); 299 closeMediaSource();
300 300
301 #if ENABLE(ENCRYPTED_MEDIA_V2) 301 #if ENABLE(ENCRYPTED_MEDIA_V2)
302 setMediaKeys(0); 302 setMediaKeys(0);
303 #endif 303 #endif
304 304
305 removeElementFromDocumentMap(this, document()); 305 removeElementFromDocumentMap(this, document());
306 306
307 m_completelyLoaded = true; 307 m_completelyLoaded = true;
308 m_player.clear(); 308 m_player.clear();
309 } 309 }
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 635
636 // 2 - If there are any tasks from the media element's media element event t ask source in 636 // 2 - If there are any tasks from the media element's media element event t ask source in
637 // one of the task queues, then remove those tasks. 637 // one of the task queues, then remove those tasks.
638 cancelPendingEventsAndCallbacks(); 638 cancelPendingEventsAndCallbacks();
639 639
640 // 3 - If the media element's networkState is set to NETWORK_LOADING or NETW ORK_IDLE, queue 640 // 3 - If the media element's networkState is set to NETWORK_LOADING or NETW ORK_IDLE, queue
641 // a task to fire a simple event named abort at the media element. 641 // a task to fire a simple event named abort at the media element.
642 if (m_networkState == NETWORK_LOADING || m_networkState == NETWORK_IDLE) 642 if (m_networkState == NETWORK_LOADING || m_networkState == NETWORK_IDLE)
643 scheduleEvent(eventNames().abortEvent); 643 scheduleEvent(eventNames().abortEvent);
644 644
645 setSourceState(MediaSource::closedKeyword()); 645 closeMediaSource();
646 646
647 createMediaPlayer(); 647 createMediaPlayer();
648 648
649 // 4 - If the media element's networkState is not set to NETWORK_EMPTY, then run these substeps 649 // 4 - If the media element's networkState is not set to NETWORK_EMPTY, then run these substeps
650 if (m_networkState != NETWORK_EMPTY) { 650 if (m_networkState != NETWORK_EMPTY) {
651 m_networkState = NETWORK_EMPTY; 651 m_networkState = NETWORK_EMPTY;
652 m_readyState = HAVE_NOTHING; 652 m_readyState = HAVE_NOTHING;
653 m_readyStateMaximum = HAVE_NOTHING; 653 m_readyStateMaximum = HAVE_NOTHING;
654 refreshCachedTime(); 654 refreshCachedTime();
655 m_paused = true; 655 m_paused = true;
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 m_error = MediaError::create(MediaError::MEDIA_ERR_SRC_NOT_SUPPORTED); 1346 m_error = MediaError::create(MediaError::MEDIA_ERR_SRC_NOT_SUPPORTED);
1347 1347
1348 // 6.2 - Forget the media element's media-resource-specific text tracks. 1348 // 6.2 - Forget the media element's media-resource-specific text tracks.
1349 1349
1350 // 6.3 - Set the element's networkState attribute to the NETWORK_NO_SOURCE v alue. 1350 // 6.3 - Set the element's networkState attribute to the NETWORK_NO_SOURCE v alue.
1351 m_networkState = NETWORK_NO_SOURCE; 1351 m_networkState = NETWORK_NO_SOURCE;
1352 1352
1353 // 7 - Queue a task to fire a simple event named error at the media element. 1353 // 7 - Queue a task to fire a simple event named error at the media element.
1354 scheduleEvent(eventNames().errorEvent); 1354 scheduleEvent(eventNames().errorEvent);
1355 1355
1356 setSourceState(MediaSource::closedKeyword()); 1356 closeMediaSource();
1357 1357
1358 // 8 - Set the element's delaying-the-load-event flag to false. This stops d elaying the load event. 1358 // 8 - Set the element's delaying-the-load-event flag to false. This stops d elaying the load event.
1359 setShouldDelayLoadEvent(false); 1359 setShouldDelayLoadEvent(false);
1360 1360
1361 // 9 - Abort these steps. Until the load() method is invoked or the src attr ibute is changed, 1361 // 9 - Abort these steps. Until the load() method is invoked or the src attr ibute is changed,
1362 // the element won't attempt to load another resource. 1362 // the element won't attempt to load another resource.
1363 1363
1364 updateDisplayState(); 1364 updateDisplayState();
1365 1365
1366 if (renderer()) 1366 if (renderer())
1367 renderer()->updateFromElement(); 1367 renderer()->updateFromElement();
1368 } 1368 }
1369 1369
1370 void HTMLMediaElement::mediaEngineError(PassRefPtr<MediaError> err) 1370 void HTMLMediaElement::mediaEngineError(PassRefPtr<MediaError> err)
1371 { 1371 {
1372 LOG(Media, "HTMLMediaElement::mediaEngineError(%d)", static_cast<int>(err->c ode())); 1372 LOG(Media, "HTMLMediaElement::mediaEngineError(%d)", static_cast<int>(err->c ode()));
1373 1373
1374 // 1 - The user agent should cancel the fetching process. 1374 // 1 - The user agent should cancel the fetching process.
1375 stopPeriodicTimers(); 1375 stopPeriodicTimers();
1376 m_loadState = WaitingForSource; 1376 m_loadState = WaitingForSource;
1377 1377
1378 // 2 - Set the error attribute to a new MediaError object whose code attribu te is 1378 // 2 - Set the error attribute to a new MediaError object whose code attribu te is
1379 // set to MEDIA_ERR_NETWORK/MEDIA_ERR_DECODE. 1379 // set to MEDIA_ERR_NETWORK/MEDIA_ERR_DECODE.
1380 m_error = err; 1380 m_error = err;
1381 1381
1382 // 3 - Queue a task to fire a simple event named error at the media element. 1382 // 3 - Queue a task to fire a simple event named error at the media element.
1383 scheduleEvent(eventNames().errorEvent); 1383 scheduleEvent(eventNames().errorEvent);
1384 1384
1385 setSourceState(MediaSource::closedKeyword()); 1385 closeMediaSource();
1386 1386
1387 // 4 - Set the element's networkState attribute to the NETWORK_EMPTY value a nd queue a 1387 // 4 - Set the element's networkState attribute to the NETWORK_EMPTY value a nd queue a
1388 // task to fire a simple event called emptied at the element. 1388 // task to fire a simple event called emptied at the element.
1389 m_networkState = NETWORK_EMPTY; 1389 m_networkState = NETWORK_EMPTY;
1390 scheduleEvent(eventNames().emptiedEvent); 1390 scheduleEvent(eventNames().emptiedEvent);
1391 1391
1392 // 5 - Set the element's delaying-the-load-event flag to false. This stops d elaying the load event. 1392 // 5 - Set the element's delaying-the-load-event flag to false. This stops d elaying the load event.
1393 setShouldDelayLoadEvent(false); 1393 setShouldDelayLoadEvent(false);
1394 1394
1395 // 6 - Abort the overall resource selection algorithm. 1395 // 6 - Abort the overall resource selection algorithm.
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
1875 // attribute then set the seeking IDL attribute to false and abort these ste ps. 1875 // attribute then set the seeking IDL attribute to false and abort these ste ps.
1876 RefPtr<TimeRanges> seekableRanges = seekable(); 1876 RefPtr<TimeRanges> seekableRanges = seekable();
1877 1877
1878 // Short circuit seeking to the current time by just firing the events if no seek is required. 1878 // Short circuit seeking to the current time by just firing the events if no seek is required.
1879 // Don't skip calling the media engine if we are in poster mode because a se ek should always 1879 // Don't skip calling the media engine if we are in poster mode because a se ek should always
1880 // cancel poster display. 1880 // cancel poster display.
1881 bool noSeekRequired = !seekableRanges->length() || (time == now && displayMo de() != Poster); 1881 bool noSeekRequired = !seekableRanges->length() || (time == now && displayMo de() != Poster);
1882 1882
1883 // Always notify the media engine of a seek if the source is not closed. Thi s ensures that the source is 1883 // Always notify the media engine of a seek if the source is not closed. Thi s ensures that the source is
1884 // always in a flushed state when the 'seeking' event fires. 1884 // always in a flushed state when the 'seeking' event fires.
1885 if (m_mediaSource && m_mediaSource->readyState() != MediaSource::closedKeywo rd()) 1885 if (m_mediaSource && m_mediaSource->readyState() != WebKitMediaSource::close dKeyword())
1886 noSeekRequired = false; 1886 noSeekRequired = false;
1887 1887
1888 if (noSeekRequired) { 1888 if (noSeekRequired) {
1889 if (time == now) { 1889 if (time == now) {
1890 scheduleEvent(eventNames().seekingEvent); 1890 scheduleEvent(eventNames().seekingEvent);
1891 scheduleTimeupdateEvent(false); 1891 scheduleTimeupdateEvent(false);
1892 scheduleEvent(eventNames().seekedEvent); 1892 scheduleEvent(eventNames().seekedEvent);
1893 } 1893 }
1894 m_seeking = false; 1894 m_seeking = false;
1895 return; 1895 return;
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
2238 2238
2239 if (!m_paused) { 2239 if (!m_paused) {
2240 m_paused = true; 2240 m_paused = true;
2241 scheduleTimeupdateEvent(false); 2241 scheduleTimeupdateEvent(false);
2242 scheduleEvent(eventNames().pauseEvent); 2242 scheduleEvent(eventNames().pauseEvent);
2243 } 2243 }
2244 2244
2245 updatePlayState(); 2245 updatePlayState();
2246 } 2246 }
2247 2247
2248 void HTMLMediaElement::setSourceState(const String& state) 2248 void HTMLMediaElement::closeMediaSource()
2249 { 2249 {
2250 if (!m_mediaSource) 2250 if (!m_mediaSource)
2251 return; 2251 return;
2252 2252
2253 m_mediaSource->setReadyState(state); 2253 m_mediaSource->setReadyState(WebKitMediaSource::closedKeyword());
2254 if (state == MediaSource::closedKeyword()) 2254 m_mediaSource = 0;
2255 m_mediaSource = 0;
2256 } 2255 }
2257 2256
2258 #if ENABLE(ENCRYPTED_MEDIA) 2257 #if ENABLE(ENCRYPTED_MEDIA)
2259 void HTMLMediaElement::webkitGenerateKeyRequest(const String& keySystem, PassRef Ptr<Uint8Array> initData, ExceptionCode& ec) 2258 void HTMLMediaElement::webkitGenerateKeyRequest(const String& keySystem, PassRef Ptr<Uint8Array> initData, ExceptionCode& ec)
2260 { 2259 {
2261 if (keySystem.isEmpty()) { 2260 if (keySystem.isEmpty()) {
2262 ec = SYNTAX_ERR; 2261 ec = SYNTAX_ERR;
2263 return; 2262 return;
2264 } 2263 }
2265 2264
(...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after
3602 3601
3603 if (m_networkState == NETWORK_EMPTY || m_completelyLoaded) 3602 if (m_networkState == NETWORK_EMPTY || m_completelyLoaded)
3604 return; 3603 return;
3605 3604
3606 // 2 - Set the error attribute to a new MediaError object whose code attribu te is set to MEDIA_ERR_ABORTED. 3605 // 2 - Set the error attribute to a new MediaError object whose code attribu te is set to MEDIA_ERR_ABORTED.
3607 m_error = MediaError::create(MediaError::MEDIA_ERR_ABORTED); 3606 m_error = MediaError::create(MediaError::MEDIA_ERR_ABORTED);
3608 3607
3609 // 3 - Queue a task to fire a simple event named error at the media element. 3608 // 3 - Queue a task to fire a simple event named error at the media element.
3610 scheduleEvent(eventNames().abortEvent); 3609 scheduleEvent(eventNames().abortEvent);
3611 3610
3612 setSourceState(MediaSource::closedKeyword()); 3611 closeMediaSource();
3613 3612
3614 // 4 - If the media element's readyState attribute has a value equal to HAVE _NOTHING, set the 3613 // 4 - If the media element's readyState attribute has a value equal to HAVE _NOTHING, set the
3615 // element's networkState attribute to the NETWORK_EMPTY value and queue a t ask to fire a 3614 // element's networkState attribute to the NETWORK_EMPTY value and queue a t ask to fire a
3616 // simple event named emptied at the element. Otherwise, set the element's n etworkState 3615 // simple event named emptied at the element. Otherwise, set the element's n etworkState
3617 // attribute to the NETWORK_IDLE value. 3616 // attribute to the NETWORK_IDLE value.
3618 if (m_readyState == HAVE_NOTHING) { 3617 if (m_readyState == HAVE_NOTHING) {
3619 m_networkState = NETWORK_EMPTY; 3618 m_networkState = NETWORK_EMPTY;
3620 scheduleEvent(eventNames().emptiedEvent); 3619 scheduleEvent(eventNames().emptiedEvent);
3621 } 3620 }
3622 else 3621 else
(...skipping 16 matching lines...) Expand all
3639 { 3638 {
3640 #if USE(PLATFORM_TEXT_TRACK_MENU) 3639 #if USE(PLATFORM_TEXT_TRACK_MENU)
3641 if (platformTextTrackMenu()) { 3640 if (platformTextTrackMenu()) {
3642 m_platformMenu->setClient(0); 3641 m_platformMenu->setClient(0);
3643 m_platformMenu = 0; 3642 m_platformMenu = 0;
3644 } 3643 }
3645 #endif 3644 #endif
3646 3645
3647 removeAllInbandTracks(); 3646 removeAllInbandTracks();
3648 3647
3649 setSourceState(MediaSource::closedKeyword()); 3648 closeMediaSource();
3650 3649
3651 m_player.clear(); 3650 m_player.clear();
3652 stopPeriodicTimers(); 3651 stopPeriodicTimers();
3653 m_loadTimer.stop(); 3652 m_loadTimer.stop();
3654 3653
3655 m_pendingActionFlags &= ~flags; 3654 m_pendingActionFlags &= ~flags;
3656 m_loadState = WaitingForSource; 3655 m_loadState = WaitingForSource;
3657 3656
3658 if (m_textTracks) 3657 if (m_textTracks)
3659 configureTextTrackDisplay(); 3658 configureTextTrackDisplay();
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
4003 } 4002 }
4004 4003
4005 void HTMLMediaElement::createMediaPlayer() 4004 void HTMLMediaElement::createMediaPlayer()
4006 { 4005 {
4007 #if ENABLE(WEB_AUDIO) 4006 #if ENABLE(WEB_AUDIO)
4008 if (m_audioSourceNode) 4007 if (m_audioSourceNode)
4009 m_audioSourceNode->lock(); 4008 m_audioSourceNode->lock();
4010 #endif 4009 #endif
4011 4010
4012 if (m_mediaSource) 4011 if (m_mediaSource)
4013 m_mediaSource->setReadyState(MediaSource::closedKeyword()); 4012 closeMediaSource();
4014 4013
4015 m_player = MediaPlayer::create(this); 4014 m_player = MediaPlayer::create(this);
4016 4015
4017 #if ENABLE(WEB_AUDIO) 4016 #if ENABLE(WEB_AUDIO)
4018 if (m_audioSourceNode) { 4017 if (m_audioSourceNode) {
4019 // When creating the player, make sure its AudioSourceProvider knows abo ut the MediaElementAudioSourceNode. 4018 // When creating the player, make sure its AudioSourceProvider knows abo ut the MediaElementAudioSourceNode.
4020 if (audioSourceProvider()) 4019 if (audioSourceProvider())
4021 audioSourceProvider()->setClient(m_audioSourceNode); 4020 audioSourceProvider()->setClient(m_audioSourceNode);
4022 4021
4023 m_audioSourceNode->unlock(); 4022 m_audioSourceNode->unlock();
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
4320 info.addMember(m_mediaGroup, "mediaGroup"); 4319 info.addMember(m_mediaGroup, "mediaGroup");
4321 info.addMember(m_mediaController, "mediaController"); 4320 info.addMember(m_mediaController, "mediaController");
4322 4321
4323 #if ENABLE(WEB_AUDIO) 4322 #if ENABLE(WEB_AUDIO)
4324 info.addMember(m_audioSourceNode, "audioSourceNode"); 4323 info.addMember(m_audioSourceNode, "audioSourceNode");
4325 #endif 4324 #endif
4326 4325
4327 } 4326 }
4328 4327
4329 } 4328 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | Source/core/html/PublicURLManager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698