[Win] Legible Output callbacks should happen on notification queue
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Oct 2013 00:50:06 +0000 (00:50 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Oct 2013 00:50:06 +0000 (00:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=123545

Reviewed by Eric Carlson.

Modify the callback creation for Legible Output items so that they
are made on our notification queue. The use of the main queue was a
holdover from some temporary code used during earlier development.

* platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
(WebCore::AVFWrapper::AVFWrapper): Assert this happens on the main thread.
(WebCore::AVFWrapper::~AVFWrapper): Ditto.
(WebCore::destroyAVFWrapper): Ditto.
(WebCore::AVFWrapper::createPlayer): Ditto.
(WebCore::AVFWrapper::createPlayerItem): Ditto.
Also, instruct LegibleOutput callbacks to happen on our notification
queue, rather than the main thread.
(WebCore::AVFWrapper::createAVCFVideoLayer): Assert this happens on the main thread.
(WebCore::AVFWrapper::destroyVideoLayer): Ditto.
(WebCore::AVFWrapper::createImageGenerator): Ditto.
(WebCore::AVFWrapper::destroyImageGenerator): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158334 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp

index 1059cb3d6d7b1be692919047c9134f59a6c95d48..80c136b582e9fa24492a9354c3e1ac14f3ff954a 100644 (file)
@@ -1,3 +1,27 @@
+2013-10-30  Brent Fulgham  <bfulgham@apple.com>
+
+        [Win] Legible Output callbacks should happen on notification queue
+        https://bugs.webkit.org/show_bug.cgi?id=123545
+
+        Reviewed by Eric Carlson.
+
+        Modify the callback creation for Legible Output items so that they
+        are made on our notification queue. The use of the main queue was a
+        holdover from some temporary code used during earlier development.
+
+        * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
+        (WebCore::AVFWrapper::AVFWrapper): Assert this happens on the main thread.
+        (WebCore::AVFWrapper::~AVFWrapper): Ditto.
+        (WebCore::destroyAVFWrapper): Ditto.
+        (WebCore::AVFWrapper::createPlayer): Ditto.
+        (WebCore::AVFWrapper::createPlayerItem): Ditto.
+        Also, instruct LegibleOutput callbacks to happen on our notification
+        queue, rather than the main thread.
+        (WebCore::AVFWrapper::createAVCFVideoLayer): Assert this happens on the main thread.
+        (WebCore::AVFWrapper::destroyVideoLayer): Ditto.
+        (WebCore::AVFWrapper::createImageGenerator): Ditto.
+        (WebCore::AVFWrapper::destroyImageGenerator): Ditto.
+
 2013-10-30  Alexey Proskuryakov  <ap@apple.com>
 
         XHR.response is null when requesting empty file as arraybuffer
index 814c25ef933b0199899ba98eafc8e60c56d61d20..8341308cd06ba8c5779e6b236ca5ab5a7168cb5c 100644 (file)
@@ -1162,6 +1162,7 @@ AVFWrapper::AVFWrapper(MediaPlayerPrivateAVFoundationCF* owner)
     , m_currentTrack(0)
 {
     ASSERT(isMainThread());
+    ASSERT(dispatch_get_main_queue() == dispatch_get_current_queue());
     LOG(Media, "AVFWrapper::AVFWrapper(%p)", this);
 
     m_notificationQueue = dispatch_queue_create("MediaPlayerPrivateAVFoundationCF.notificationQueue", 0);
@@ -1171,6 +1172,7 @@ AVFWrapper::AVFWrapper(MediaPlayerPrivateAVFoundationCF* owner)
 AVFWrapper::~AVFWrapper()
 {
     ASSERT(isMainThread());
+    ASSERT(dispatch_get_main_queue() == dispatch_get_current_queue());
     LOG(Media, "AVFWrapper::~AVFWrapper(%p %d)", this, m_objectID);
 
     destroyVideoLayer();
@@ -1251,6 +1253,8 @@ void AVFWrapper::scheduleDisconnectAndDelete()
 
 static void destroyAVFWrapper(void* context)
 {
+    ASSERT(isMainThread());
+    ASSERT(dispatch_get_main_queue() == dispatch_get_current_queue());
     AVFWrapper* avfWrapper = static_cast<AVFWrapper*>(context);
     if (!avfWrapper)
         return;
@@ -1306,6 +1310,8 @@ void AVFWrapper::createAssetForURL(const String& url)
 
 void AVFWrapper::createPlayer(IDirect3DDevice9* d3dDevice)
 {
+    ASSERT(isMainThread());
+    ASSERT(dispatch_get_main_queue() == dispatch_get_current_queue());
     ASSERT(!avPlayer() && avPlayerItem());
 
     RetainPtr<CFMutableDictionaryRef> optionsRef = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
@@ -1347,6 +1353,8 @@ void AVFWrapper::createPlayer(IDirect3DDevice9* d3dDevice)
 
 void AVFWrapper::createPlayerItem()
 {
+    ASSERT(isMainThread());
+    ASSERT(dispatch_get_main_queue() == dispatch_get_current_queue());
     ASSERT(!avPlayerItem() && avAsset());
 
     // Create the player item so we begin loading media data.
@@ -1382,7 +1390,7 @@ void AVFWrapper::createPlayerItem()
     callbackInfo.context = callbackContext();
     callbackInfo.legibleOutputCallback = AVFWrapper::legibleOutputCallback;
 
-    AVCFPlayerItemLegibleOutputSetCallbacks(m_legibleOutput.get(), &callbackInfo, dispatch_get_main_queue());
+    AVCFPlayerItemLegibleOutputSetCallbacks(m_legibleOutput.get(), &callbackInfo, dispatchQueue());
     AVCFPlayerItemLegibleOutputSetAdvanceIntervalForCallbackInvocation(m_legibleOutput.get(), legibleOutputAdvanceInterval);
     AVCFPlayerItemLegibleOutputSetTextStylingResolution(m_legibleOutput.get(), AVCFPlayerItemLegibleOutputTextStylingResolutionSourceAndRulesOnly);
     AVCFPlayerItemAddOutput(m_avPlayerItem.get(), m_legibleOutput.get());
@@ -1608,6 +1616,8 @@ PlatformLayer* AVFWrapper::platformLayer()
 
 void AVFWrapper::createAVCFVideoLayer()
 {
+    ASSERT(isMainThread());
+    ASSERT(dispatch_get_main_queue() == dispatch_get_current_queue());
     if (!avPlayer() || m_avCFVideoLayer)
         return;
 
@@ -1618,6 +1628,8 @@ void AVFWrapper::createAVCFVideoLayer()
 
 void AVFWrapper::destroyVideoLayer()
 {
+    ASSERT(isMainThread());
+    ASSERT(dispatch_get_main_queue() == dispatch_get_current_queue());
     LOG(Media, "AVFWrapper::destroyVideoLayer(%p)", this);
     m_layerClient = nullptr;
     m_caVideoLayer = 0;
@@ -1643,6 +1655,8 @@ void AVFWrapper::setVideoLayerHidden(bool value)
 
 void AVFWrapper::createImageGenerator()
 {
+    ASSERT(isMainThread());
+    ASSERT(dispatch_get_main_queue() == dispatch_get_current_queue());
     if (!avAsset() || m_imageGenerator)
         return;
 
@@ -1658,6 +1672,8 @@ void AVFWrapper::createImageGenerator()
 
 void AVFWrapper::destroyImageGenerator()
 {
+    ASSERT(isMainThread());
+    ASSERT(dispatch_get_main_queue() == dispatch_get_current_queue());
     LOG(Media, "AVFWrapper::destroyImageGenerator(%p)", this);
     m_imageGenerator = 0;
 }