Title: [95104] trunk/Source/WebCore
Revision
95104
Author
eric.carl...@apple.com
Date
2011-09-14 11:41:32 -0700 (Wed, 14 Sep 2011)

Log Message

MediaPlayerPrivateAVFoundationObjC's "periodic time observer" is unnecessary
https://bugs.webkit.org/show_bug.cgi?id=68056

MediaPlayerPrivateAVFoundationObjC creates a "periodic time observer" not because it wants
periodic callbacks, but because a time observer also fires whenever a seek completes. This is 
no longer necessary because it now uses but AVPlayerItem's 
-seekToTime:toleranceBefore:toleranceAfter:completionHandler to seek, so seek completions are
always notified.

Reviewed by Darin Adler.

No new tests, code removed is tested by existing tests.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (95103 => 95104)


--- trunk/Source/WebCore/ChangeLog	2011-09-14 18:35:49 UTC (rev 95103)
+++ trunk/Source/WebCore/ChangeLog	2011-09-14 18:41:32 UTC (rev 95104)
@@ -1,3 +1,21 @@
+2011-09-14  Eric Carlson  <eric.carl...@apple.com>
+
+        MediaPlayerPrivateAVFoundationObjC's "periodic time observer" is unnecessary
+        https://bugs.webkit.org/show_bug.cgi?id=68056
+
+        MediaPlayerPrivateAVFoundationObjC creates a "periodic time observer" not because it wants
+        periodic callbacks, but because a time observer also fires whenever a seek completes. This is 
+        no longer necessary because it now uses but AVPlayerItem's 
+        -seekToTime:toleranceBefore:toleranceAfter:completionHandler to seek, so seek completions are
+        always notified.
+
+        Reviewed by Darin Adler.
+
+        No new tests, code removed is tested by existing tests.
+
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
+
 2011-09-14  Beth Dakin  <bda...@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=68054

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (95103 => 95104)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2011-09-14 18:35:49 UTC (rev 95103)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2011-09-14 18:41:32 UTC (rev 95104)
@@ -105,7 +105,6 @@
 -(void)disconnect;
 -(void)playableKnown;
 -(void)metadataLoaded;
--(void)timeChanged:(double)time;
 -(void)seekCompleted:(BOOL)finished;
 -(void)didEnd:(NSNotification *)notification;
 -(void)observeValueForKeyPath:keyPath ofObject:(id)object change:(NSDictionary *)change context:(MediaPlayerAVFoundationObservationContext)context;
@@ -280,14 +279,6 @@
     m_avPlayer.adoptNS([[AVPlayer alloc] init]);
     [m_avPlayer.get() addObserver:m_objcObserver.get() forKeyPath:@"rate" options:nil context:(void *)MediaPlayerAVFoundationObservationContextPlayer];
     
-    // Add a time observer, ask to be called infrequently because we don't really want periodic callbacks but
-    // our observer will also be called whenever a seek happens.
-    const double veryLongInterval = 60 * 60 * 24 * 30;
-    WebCoreAVFMovieObserver *observer = m_objcObserver.get();
-    m_timeObserver = [m_avPlayer.get() addPeriodicTimeObserverForInterval:CMTimeMakeWithSeconds(veryLongInterval, 10) queue:nil usingBlock:^(CMTime time){
-        [observer timeChanged:CMTimeGetSeconds(time)];
-    }];
-    
     if (m_avPlayerItem)
         [m_avPlayer.get() replaceCurrentItemWithPlayerItem:m_avPlayerItem.get()];
 
@@ -842,14 +833,6 @@
     m_callback->scheduleMainThreadNotification(MediaPlayerPrivateAVFoundation::Notification::AssetPlayabilityKnown);
 }
 
-- (void)timeChanged:(double)time
-{
-    if (!m_callback)
-        return;
-
-    m_callback->scheduleMainThreadNotification(MediaPlayerPrivateAVFoundation::Notification::PlayerTimeChanged, time);
-}
-
 - (void)seekCompleted:(BOOL)finished
 {
     if (!m_callback)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to