NSInvalidArgumentException in [WebAVSampleBufferErrorListener observeValueForKeyPath...
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Feb 2019 04:44:57 +0000 (04:44 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Feb 2019 04:44:57 +0000 (04:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=194123
<rdar://problem/47721094>

Reviewed by Eric Carlson.

According to crash logs, AVSampleBufferDisplayLayer.error can go from an NSError* to nil; when such a change is KVO'd,
the NSKeyValueChangeNewKey is a NSNull. Detect this state and bail out early.

* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(-[WebAVSampleBufferErrorListener observeValueForKeyPath:ofObject:change:context:]):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm

index 9338289..6e066c9 100644 (file)
@@ -1,5 +1,19 @@
 2019-01-31  Jer Noble  <jer.noble@apple.com>
 
+        NSInvalidArgumentException in [WebAVSampleBufferErrorListener observeValueForKeyPath:ofObject:change:context:]
+        https://bugs.webkit.org/show_bug.cgi?id=194123
+        <rdar://problem/47721094>
+
+        Reviewed by Eric Carlson.
+
+        According to crash logs, AVSampleBufferDisplayLayer.error can go from an NSError* to nil; when such a change is KVO'd,
+        the NSKeyValueChangeNewKey is a NSNull. Detect this state and bail out early.
+
+        * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
+        (-[WebAVSampleBufferErrorListener observeValueForKeyPath:ofObject:change:context:]):
+
+2019-01-31  Jer Noble  <jer.noble@apple.com>
+
         [Cocoa][EME] AirPlaying a FairPlay-protected HLS stream fails to decrypt
         https://bugs.webkit.org/show_bug.cgi?id=194114
 
index e400f50..11afe9f 100644 (file)
@@ -356,6 +356,9 @@ ALLOW_NEW_API_WITHOUT_GUARDS_END
 
         if ([keyPath isEqualToString:@"error"]) {
             RetainPtr<NSError> error = [change valueForKey:NSKeyValueChangeNewKey];
+            if ([error isKindOfClass:[NSNull class]])
+                return;
+
             callOnMainThread([parent = _parent, layer = WTFMove(layer), error = WTFMove(error)] {
                 if (parent)
                     parent->layerDidReceiveError(layer.get(), error.get());
@@ -373,6 +376,8 @@ ALLOW_NEW_API_WITHOUT_GUARDS_END
         RetainPtr<AVSampleBufferAudioRenderer> renderer = (AVSampleBufferAudioRenderer *)object;
         ALLOW_NEW_API_WITHOUT_GUARDS_END
         RetainPtr<NSError> error = [change valueForKey:NSKeyValueChangeNewKey];
+        if ([error isKindOfClass:[NSNull class]])
+            return;
 
         ASSERT(_renderers.contains(renderer.get()));
         ASSERT([keyPath isEqualToString:@"error"]);