Title: [176482] trunk/Source/WebCore
Revision
176482
Author
[email protected]
Date
2014-11-21 16:04:58 -0800 (Fri, 21 Nov 2014)

Log Message

[EME][Mac] Check the underlying error if the one returned by AVFoundation is AVErrorUnknown.
https://bugs.webkit.org/show_bug.cgi?id=138986

Reviewed by Eric Carlson.

When we recieve an error with the code AVErrorUnknown, look for an underlying error from CoreMedia (or another
lower-level framework) with a (presumably) more informative error code, and return that code instead.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (176481 => 176482)


--- trunk/Source/WebCore/ChangeLog	2014-11-22 00:02:59 UTC (rev 176481)
+++ trunk/Source/WebCore/ChangeLog	2014-11-22 00:04:58 UTC (rev 176482)
@@ -1,3 +1,18 @@
+2014-11-21  Jer Noble  <[email protected]>
+
+        [EME][Mac] Check the underlying error if the one returned by AVFoundation is AVErrorUnknown.
+        https://bugs.webkit.org/show_bug.cgi?id=138986
+
+        Reviewed by Eric Carlson.
+
+        When we recieve an error with the code AVErrorUnknown, look for an underlying error from CoreMedia (or another
+        lower-level framework) with a (presumably) more informative error code, and return that code instead.
+
+        * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
+        (WebCore::systemCodeForError):
+        (WebCore::CDMSessionMediaSourceAVFObjC::layerDidReceiveError):
+        (WebCore::CDMSessionMediaSourceAVFObjC::rendererDidReceiveError):
+
 2014-11-21  Chris Fleizach  <[email protected]>
 
         AX: Unclear that user and password are autofilled, no VoiceOver version of the yellow outline.

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


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm	2014-11-22 00:02:59 UTC (rev 176481)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm	2014-11-22 00:04:58 UTC (rev 176482)
@@ -36,6 +36,7 @@
 #import "SourceBufferPrivateAVFObjC.h"
 #import "SoftLinking.h"
 #import "UUID.h"
+#import <AVFoundation/AVError.h>
 #import <CoreMedia/CMBase.h>
 #import <cstdlib>
 #import <objc/objc-runtime.h>
@@ -262,12 +263,25 @@
     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)
         return;
 
-    m_client->sendError(CDMSessionClient::MediaKeyErrorDomain, std::abs([error code]));
+    m_client->sendError(CDMSessionClient::MediaKeyErrorDomain, std::abs(systemCodeForError(error)));
 }
 
 void CDMSessionMediaSourceAVFObjC::rendererDidReceiveError(AVSampleBufferAudioRenderer *, NSError *error)
@@ -275,7 +289,7 @@
     if (!m_client)
         return;
 
-    m_client->sendError(CDMSessionClient::MediaKeyErrorDomain, std::abs([error code]));
+    m_client->sendError(CDMSessionClient::MediaKeyErrorDomain, std::abs(systemCodeForError(error)));
 }
 
 void CDMSessionMediaSourceAVFObjC::setStreamSession(AVStreamSession *streamSession)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to