Title: [176879] trunk/Source/WebCore
Revision
176879
Author
[email protected]
Date
2014-12-05 15:25:31 -0800 (Fri, 05 Dec 2014)

Log Message

[MSE][Mac] Return absolute value of error code from CDMSessionMediaSourceAVFObjC::update().
https://bugs.webkit.org/show_bug.cgi?id=139316

Reviewed by Eric Carlson.

Similarly to our asynchronous error reporting, return the absolute value of the error code.

* platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
(WebCore::systemCodeForError):
(WebCore::CDMSessionMediaSourceAVFObjC::update):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (176878 => 176879)


--- trunk/Source/WebCore/ChangeLog	2014-12-05 23:11:49 UTC (rev 176878)
+++ trunk/Source/WebCore/ChangeLog	2014-12-05 23:25:31 UTC (rev 176879)
@@ -1,3 +1,16 @@
+2014-12-05  Jer Noble  <[email protected]>
+
+        [MSE][Mac] Return absolute value of error code from CDMSessionMediaSourceAVFObjC::update().
+        https://bugs.webkit.org/show_bug.cgi?id=139316
+
+        Reviewed by Eric Carlson.
+
+        Similarly to our asynchronous error reporting, return the absolute value of the error code.
+
+        * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
+        (WebCore::systemCodeForError):
+        (WebCore::CDMSessionMediaSourceAVFObjC::update):
+
 2014-12-05  Anders Carlsson  <[email protected]>
 
         Fix build on Windows.

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm (176878 => 176879)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm	2014-12-05 23:11:49 UTC (rev 176878)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm	2014-12-05 23:25:31 UTC (rev 176879)
@@ -177,6 +177,19 @@
     return !literal[length];
 }
 
+static NSInteger systemCodeForError(NSError *error)
+{
+    NSInteger code = [error code];
+    if (code != AVErrorUnknown)
+        return code;
+
+    NSError* underlyingError = [error valueForKey:NSUnderlyingErrorKey];
+    if (!underlyingError || ![underlyingError isKindOfClass:[NSError class]])
+        return code;
+    
+    return [underlyingError code];
+}
+
 bool CDMSessionMediaSourceAVFObjC::update(Uint8Array* key, RefPtr<Uint8Array>& nextMessage, unsigned short& errorCode, unsigned long& systemCode)
 {
     bool shouldGenerateKeyRequest = !m_certificate || isEqual(key, "renew");
@@ -244,7 +257,7 @@
         if (error) {
             LOG(Media, "CDMSessionMediaSourceAVFObjC::update(%p) - error:%@", this, [error description]);
             errorCode = MediaPlayer::InvalidPlayerState;
-            systemCode = [error code];
+            systemCode = std::abs(systemCodeForError(error));
             return false;
         }
 
@@ -263,19 +276,6 @@
     return true;
 }
 
-static NSInteger systemCodeForError(NSError *error)
-{
-    NSInteger code = [error code];
-    if (code != AVErrorUnknown)
-        return code;
-
-    NSError* underlyingError = [error valueForKey:NSUnderlyingErrorKey];
-    if (!underlyingError || ![underlyingError isKindOfClass:[NSError class]])
-        return code;
-
-    return [underlyingError code];
-}
-
 void CDMSessionMediaSourceAVFObjC::layerDidReceiveError(AVSampleBufferDisplayLayer *, NSError *error)
 {
     if (!m_client)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to