Diff
Modified: tags/Safari-538.39.41/Source/WebCore/ChangeLog (169869 => 169870)
--- tags/Safari-538.39.41/Source/WebCore/ChangeLog 2014-06-12 02:03:34 UTC (rev 169869)
+++ tags/Safari-538.39.41/Source/WebCore/ChangeLog 2014-06-12 02:10:01 UTC (rev 169870)
@@ -1,79 +1,3 @@
-2014-06-11 Dana Burkart <[email protected]>
-
- Merge r169855.
-
- 2014-06-11 Andy Estes <[email protected]>
-
- Fix the Mac build.
-
- * WebCore.exp.in: Exported __ZN7WebCore19ResourceRequestBase15setHTTPReferrerERKN3WTF6StringE
- * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: Moved ivar declarations to @interface to account for the 32-bit legacy runtime.
-
-2014-06-11 Dana Burkart <[email protected]>
-
- Merge r169843.
-
- 2014-06-11 Jer Noble <[email protected]>
-
- Unreviwed Mac release build fix; mark the keyPath parameter as unused.
-
- * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
- (-[WebAVSampleBufferErrorListener observeValueForKeyPath:ofObject:change:context:]):
-
-2014-06-11 Dana Burkart <[email protected]>
-
- Merge r169830.
-
- 2014-06-11 Jer Noble <[email protected]>
-
- [EME][Mac] Propagate errors from AVSampleBufferDisplayLayer through to MSE
- https://bugs.webkit.org/show_bug.cgi?id=133747
-
- Reviewed by Eric Carlson.
-
- Abstract out the delivery of errors in MediaKeySession into its own method, which can be triggered by
- CDMSession objects through the CDMSessionClient interface:
- * Modules/encryptedmedia/MediaKeySession.cpp:
- (WebCore::MediaKeySession::keyRequestTimerFired):
- (WebCore::MediaKeySession::addKeyTimerFired):
- (WebCore::MediaKeySession::sendMessage):
- (WebCore::MediaKeySession::sendError):
- * Modules/encryptedmedia/MediaKeySession.h:
- * Modules/mediasource/SourceBuffer.cpp:
- (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveRenderingError):
- * Modules/mediasource/SourceBuffer.h:
- * platform/graphics/SourceBufferPrivateClient.h:
- * platform/graphics/CDMSession.h:
-
- Add an Objective-C object which can listen for error KVO notifications:
- * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
- (WebCore::SourceBufferPrivateAVFObjCErrorClient::~SourceBufferPrivateAVFObjCErrorClient):
- * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
- (-[WebAVSampleBufferErrorListener initWithParent:WebCore::]):
- (-[WebAVSampleBufferErrorListener dealloc]):
- (-[WebAVSampleBufferErrorListener invalidate]):
- (-[WebAVSampleBufferErrorListener beginObservingLayer:]):
- (-[WebAVSampleBufferErrorListener stopObservingLayer:]):
- (-[WebAVSampleBufferErrorListener beginObservingRenderer:]):
- (-[WebAVSampleBufferErrorListener stopObservingRenderer:]):
- (-[WebAVSampleBufferErrorListener observeValueForKeyPath:ofObject:change:context:]):
- (-[WebAVSampleBufferErrorListener layerFailedToDecode:]):
- (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
- (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
- (WebCore::SourceBufferPrivateAVFObjC::registerForErrorNotifications):
- (WebCore::SourceBufferPrivateAVFObjC::unregisterForErrorNotifications):
- (WebCore::SourceBufferPrivateAVFObjC::layerDidReceiveError):
- (WebCore::SourceBufferPrivateAVFObjC::rendererDidReceiveError):
-
- Register for the new error notifications:
- * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h:
- (WebCore::CDMSessionMediaSourceAVFObjC::~CDMSessionMediaSourceAVFObjC): Moved to source file.
- * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
- (WebCore::CDMSessionMediaSourceAVFObjC::CDMSessionMediaSourceAVFObjC): Register for error notifications.
- (WebCore::CDMSessionMediaSourceAVFObjC::~CDMSessionMediaSourceAVFObjC): Unregister for error notifications.
- (WebCore::CDMSessionMediaSourceAVFObjC::layerDidReceiveError): Pass through to CDMSessionClient.
- (WebCore::CDMSessionMediaSourceAVFObjC::rendererDidReceiveError): Ditto.
-
2014-06-10 Matthew Hanson <[email protected]>
Merge r169681.
Modified: tags/Safari-538.39.41/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp (169869 => 169870)
--- tags/Safari-538.39.41/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp 2014-06-12 02:03:34 UTC (rev 169869)
+++ tags/Safari-538.39.41/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp 2014-06-12 02:10:01 UTC (rev 169870)
@@ -112,9 +112,16 @@
// 3.1. Create a new MediaKeyError object with the following attributes:
// code = the appropriate MediaKeyError code
// systemCode = a Key System-specific value, if provided, and 0 otherwise
+ RefPtr<MediaKeyError> error = MediaKeyError::create(errorCode, systemCode).get();
+
// 3.2. Set the MediaKeySession object's error attribute to the error object created in the previous step.
+ setError(error.get());
+
// 3.3. queue a task to fire a simple event named keyerror at the MediaKeySession object.
- sendError(errorCode, systemCode);
+ RefPtr<Event> event = Event::create(eventNames().webkitkeyerrorEvent, false, false);
+ event->setTarget(this);
+ m_asyncEventQueue.enqueueEvent(event.release());
+
// 3.4. Abort the task.
continue;
}
@@ -123,7 +130,14 @@
// The event is of type MediaKeyMessageEvent and has:
// message = key request
// destinationURL = destinationURL
- sendMessage(keyRequest.get(), destinationURL);
+ MediaKeyMessageEventInit init;
+ init.bubbles = false;
+ init.cancelable = false;
+ init.message = keyRequest;
+ init.destinationURL = destinationURL;
+ RefPtr<MediaKeyMessageEvent> event = MediaKeyMessageEvent::create(eventNames().webkitkeymessageEvent, init);
+ event->setTarget(this);
+ m_asyncEventQueue.enqueueEvent(event.release());
}
}
@@ -170,8 +184,15 @@
// The event is of type MediaKeyMessageEvent and has:
// message = next message
// destinationURL = null
- if (nextMessage)
- sendMessage(nextMessage.get(), emptyString());
+ if (nextMessage) {
+ MediaKeyMessageEventInit init;
+ init.bubbles = false;
+ init.cancelable = false;
+ init.message = nextMessage;
+ RefPtr<MediaKeyMessageEvent> event = MediaKeyMessageEvent::create(eventNames().webkitkeymessageEvent, init);
+ event->setTarget(this);
+ m_asyncEventQueue.enqueueEvent(event.release());
+ }
// 2.7. If did store key is true, queue a task to fire a simple event named keyadded at the MediaKeySession object.
if (didStoreKey) {
@@ -185,37 +206,22 @@
// 2.8.1. Create a new MediaKeyError object with the following attributes:
// code = the appropriate MediaKeyError code
// systemCode = a Key System-specific value, if provided, and 0 otherwise
+ RefPtr<MediaKeyError> error = MediaKeyError::create(errorCode, systemCode).get();
+
// 2.8.2. Set the MediaKeySession object's error attribute to the error object created in the previous step.
+ setError(error.get());
+
// 2.8.3. queue a task to fire a simple event named keyerror at the MediaKeySession object.
- sendError(errorCode, systemCode);
+ RefPtr<Event> keyerrorEvent = Event::create(eventNames().webkitkeyerrorEvent, false, false);
+ keyerrorEvent->setTarget(this);
+ m_asyncEventQueue.enqueueEvent(keyerrorEvent.release());
+
// 2.8.4. Abort the task.
// NOTE: no-op
}
}
}
-void MediaKeySession::sendMessage(Uint8Array* message, String destinationURL)
-{
- MediaKeyMessageEventInit init;
- init.bubbles = false;
- init.cancelable = false;
- init.message = message;
- init.destinationURL = destinationURL;
- RefPtr<MediaKeyMessageEvent> event = MediaKeyMessageEvent::create(eventNames().webkitkeymessageEvent, init);
- event->setTarget(this);
- m_asyncEventQueue.enqueueEvent(event.release());
}
-void MediaKeySession::sendError(CDMSessionClient::MediaKeyErrorCode errorCode, unsigned long systemCode)
-{
- RefPtr<MediaKeyError> error = MediaKeyError::create(errorCode, systemCode).get();
- setError(error.get());
-
- RefPtr<Event> keyerrorEvent = Event::create(eventNames().webkitkeyerrorEvent, false, false);
- keyerrorEvent->setTarget(this);
- m_asyncEventQueue.enqueueEvent(keyerrorEvent.release());
-}
-
-}
-
#endif
Modified: tags/Safari-538.39.41/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h (169869 => 169870)
--- tags/Safari-538.39.41/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h 2014-06-12 02:03:34 UTC (rev 169869)
+++ tags/Safari-538.39.41/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h 2014-06-12 02:10:01 UTC (rev 169870)
@@ -29,7 +29,6 @@
#if ENABLE(ENCRYPTED_MEDIA_V2)
#include "ActiveDOMObject.h"
-#include "CDMSession.h"
#include "EventTarget.h"
#include "ExceptionCode.h"
#include "GenericEventQueue.h"
@@ -44,8 +43,9 @@
class MediaKeyError;
class MediaKeys;
+class CDMSession;
-class MediaKeySession final : public RefCounted<MediaKeySession>, public EventTargetWithInlineData, public ActiveDOMObject, public CDMSessionClient {
+class MediaKeySession final : public RefCounted<MediaKeySession>, public EventTargetWithInlineData, public ActiveDOMObject {
public:
static PassRefPtr<MediaKeySession> create(ScriptExecutionContext*, MediaKeys*, const String& keySystem);
~MediaKeySession();
@@ -85,10 +85,6 @@
void keyRequestTimerFired(Timer<MediaKeySession>&);
void addKeyTimerFired(Timer<MediaKeySession>&);
- // CDMSessionClient
- virtual void sendMessage(Uint8Array*, String destinationURL);
- virtual void sendError(MediaKeyErrorCode, unsigned long systemCode);
-
MediaKeys* m_keys;
String m_keySystem;
String m_sessionId;
Modified: tags/Safari-538.39.41/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (169869 => 169870)
--- tags/Safari-538.39.41/Source/WebCore/Modules/mediasource/SourceBuffer.cpp 2014-06-12 02:03:34 UTC (rev 169869)
+++ tags/Safari-538.39.41/Source/WebCore/Modules/mediasource/SourceBuffer.cpp 2014-06-12 02:10:01 UTC (rev 169870)
@@ -535,11 +535,6 @@
reportExtraMemoryCost();
}
-void SourceBuffer::sourceBufferPrivateDidReceiveRenderingError(SourceBufferPrivate*, int)
-{
- m_source->streamEndedWithError(decodeError(), IgnorableExceptionCode());
-}
-
void SourceBuffer::removeCodedFrames(const MediaTime& start, const MediaTime& end)
{
// 3.5.9 Coded Frame Removal Algorithm
Modified: tags/Safari-538.39.41/Source/WebCore/Modules/mediasource/SourceBuffer.h (169869 => 169870)
--- tags/Safari-538.39.41/Source/WebCore/Modules/mediasource/SourceBuffer.h 2014-06-12 02:03:34 UTC (rev 169869)
+++ tags/Safari-538.39.41/Source/WebCore/Modules/mediasource/SourceBuffer.h 2014-06-12 02:10:01 UTC (rev 169870)
@@ -119,7 +119,6 @@
virtual void sourceBufferPrivateSeekToTime(SourceBufferPrivate*, const MediaTime&);
virtual MediaTime sourceBufferPrivateFastSeekTimeForMediaTime(SourceBufferPrivate*, const MediaTime&, const MediaTime& negativeThreshold, const MediaTime& positiveThreshold);
virtual void sourceBufferPrivateAppendComplete(SourceBufferPrivate*, AppendResult) override;
- virtual void sourceBufferPrivateDidReceiveRenderingError(SourceBufferPrivate*, int errorCode) override;
// AudioTrackClient
virtual void audioTrackEnabledChanged(AudioTrack*) override;
Modified: tags/Safari-538.39.41/Source/WebCore/WebCore.exp.in (169869 => 169870)
--- tags/Safari-538.39.41/Source/WebCore/WebCore.exp.in 2014-06-12 02:03:34 UTC (rev 169869)
+++ tags/Safari-538.39.41/Source/WebCore/WebCore.exp.in 2014-06-12 02:10:01 UTC (rev 169870)
@@ -810,7 +810,6 @@
__ZN7WebCore19MediaSessionManager9addClientEPNS_25MediaSessionManagerClientE
__ZN7WebCore19ResourceRequestBase11setHTTPBodyEN3WTF10PassRefPtrINS_8FormDataEEE
__ZN7WebCore19ResourceRequestBase13setHTTPMethodERKN3WTF6StringE
-__ZN7WebCore19ResourceRequestBase15setHTTPReferrerERKN3WTF6StringE
__ZN7WebCore19ResourceRequestBase18setHTTPHeaderFieldEPKcRKN3WTF6StringE
__ZN7WebCore19ResourceRequestBase19addHTTPHeaderFieldsERKNS_13HTTPHeaderMapE
__ZN7WebCore19ResourceRequestBase22defaultTimeoutIntervalEv
Modified: tags/Safari-538.39.41/Source/WebCore/platform/graphics/CDMSession.h (169869 => 169870)
--- tags/Safari-538.39.41/Source/WebCore/platform/graphics/CDMSession.h 2014-06-12 02:03:34 UTC (rev 169869)
+++ tags/Safari-538.39.41/Source/WebCore/platform/graphics/CDMSession.h 2014-06-12 02:10:01 UTC (rev 169870)
@@ -39,17 +39,6 @@
public:
virtual ~CDMSessionClient() { };
virtual void sendMessage(Uint8Array*, String destinationURL) = 0;
-
- enum {
- MediaKeyErrorUnknown = 1,
- MediaKeyErrorClient,
- MediaKeyErrorService,
- MediaKeyErrorOutput,
- MediaKeyErrorHardwareChange,
- MediaKeyErrorDomain,
- };
- typedef unsigned short MediaKeyErrorCode;
- virtual void sendError(MediaKeyErrorCode, unsigned long systemCode) = 0;
};
class CDMSession {
Modified: tags/Safari-538.39.41/Source/WebCore/platform/graphics/SourceBufferPrivateClient.h (169869 => 169870)
--- tags/Safari-538.39.41/Source/WebCore/platform/graphics/SourceBufferPrivateClient.h 2014-06-12 02:03:34 UTC (rev 169869)
+++ tags/Safari-538.39.41/Source/WebCore/platform/graphics/SourceBufferPrivateClient.h 2014-06-12 02:10:01 UTC (rev 169870)
@@ -84,7 +84,6 @@
ParsingFailed,
};
virtual void sourceBufferPrivateAppendComplete(SourceBufferPrivate*, AppendResult) = 0;
- virtual void sourceBufferPrivateDidReceiveRenderingError(SourceBufferPrivate*, int errocCode) = 0;
};
}
Modified: tags/Safari-538.39.41/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h (169869 => 169870)
--- tags/Safari-538.39.41/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h 2014-06-12 02:03:34 UTC (rev 169869)
+++ tags/Safari-538.39.41/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h 2014-06-12 02:10:01 UTC (rev 169870)
@@ -27,7 +27,6 @@
#define CDMSessionMediaSourceAVFObjC_h
#include "CDMSession.h"
-#include "SourceBufferPrivateAVFObjC.h"
#include <wtf/PassOwnPtr.h>
#include <wtf/RetainPtr.h>
@@ -35,10 +34,12 @@
namespace WebCore {
-class CDMSessionMediaSourceAVFObjC : public CDMSession, public SourceBufferPrivateAVFObjCErrorClient {
+class SourceBufferPrivateAVFObjC;
+
+class CDMSessionMediaSourceAVFObjC : public CDMSession {
public:
CDMSessionMediaSourceAVFObjC(SourceBufferPrivateAVFObjC* parent);
- virtual ~CDMSessionMediaSourceAVFObjC();
+ virtual ~CDMSessionMediaSourceAVFObjC() { }
virtual void setClient(CDMSessionClient* client) override { m_client = client; }
virtual const String& sessionId() const override { return m_sessionId; }
@@ -46,11 +47,8 @@
virtual void releaseKeys() override;
virtual bool update(Uint8Array*, RefPtr<Uint8Array>& nextMessage, unsigned short& errorCode, unsigned long& systemCode) override;
- virtual void layerDidReceiveError(AVSampleBufferDisplayLayer *, NSError *);
- virtual void rendererDidReceiveError(AVSampleBufferAudioRenderer *, NSError *);
-
protected:
- RefPtr<SourceBufferPrivateAVFObjC> m_parent;
+ SourceBufferPrivateAVFObjC* m_parent;
CDMSessionClient* m_client;
RefPtr<Uint8Array> m_initData;
RefPtr<Uint8Array> m_certificate;
Modified: tags/Safari-538.39.41/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm (169869 => 169870)
--- tags/Safari-538.39.41/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm 2014-06-12 02:03:34 UTC (rev 169869)
+++ tags/Safari-538.39.41/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm 2014-06-12 02:10:01 UTC (rev 169870)
@@ -58,16 +58,8 @@
, m_client(nullptr)
, m_sessionId(createCanonicalUUIDString())
{
- ASSERT(parent);
- parent->registerForErrorNotifications(this);
}
-CDMSessionMediaSourceAVFObjC::~CDMSessionMediaSourceAVFObjC()
-{
- m_parent->unregisterForErrorNotifications(this);
- m_client = nullptr;
-}
-
PassRefPtr<Uint8Array> CDMSessionMediaSourceAVFObjC::generateKeyRequest(const String& mimeType, Uint8Array* initData, String& destinationURL, unsigned short& errorCode, unsigned long& systemCode)
{
UNUSED_PARAM(mimeType);
@@ -145,22 +137,6 @@
return true;
}
-void CDMSessionMediaSourceAVFObjC::layerDidReceiveError(AVSampleBufferDisplayLayer *, NSError *error)
-{
- if (!m_client)
- return;
-
- m_client->sendError(CDMSessionClient::MediaKeyErrorDomain, [error code]);
}
-void CDMSessionMediaSourceAVFObjC::rendererDidReceiveError(AVSampleBufferAudioRenderer *, NSError *error)
-{
- if (!m_client)
- return;
-
- m_client->sendError(CDMSessionClient::MediaKeyErrorDomain, [error code]);
-}
-
-}
-
#endif
Modified: tags/Safari-538.39.41/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h (169869 => 169870)
--- tags/Safari-538.39.41/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h 2014-06-12 02:03:34 UTC (rev 169869)
+++ tags/Safari-538.39.41/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h 2014-06-12 02:10:01 UTC (rev 169870)
@@ -47,8 +47,6 @@
OBJC_CLASS NSError;
OBJC_CLASS NSObject;
OBJC_CLASS WebAVStreamDataParserListener;
-OBJC_CLASS WebAVSampleBufferErrorListener;
-
typedef struct opaqueCMSampleBuffer *CMSampleBufferRef;
typedef const struct opaqueCMFormatDescription *CMFormatDescriptionRef;
@@ -61,13 +59,6 @@
class AudioTrackPrivateMediaSourceAVFObjC;
class VideoTrackPrivateMediaSourceAVFObjC;
-class SourceBufferPrivateAVFObjCErrorClient {
-public:
- virtual ~SourceBufferPrivateAVFObjCErrorClient() { }
- virtual void layerDidReceiveError(AVSampleBufferDisplayLayer *, NSError *) = 0;
- virtual void rendererDidReceiveError(AVSampleBufferAudioRenderer *, NSError *) = 0;
-};
-
class SourceBufferPrivateAVFObjC final : public SourceBufferPrivate {
public:
static RefPtr<SourceBufferPrivateAVFObjC> create(MediaSourcePrivateAVFObjC*);
@@ -97,11 +88,6 @@
int protectedTrackID() const { return m_protectedTrackID; }
AVStreamDataParser* parser() const { return m_parser.get(); }
- void registerForErrorNotifications(SourceBufferPrivateAVFObjCErrorClient*);
- void unregisterForErrorNotifications(SourceBufferPrivateAVFObjCErrorClient*);
- void layerDidReceiveError(AVSampleBufferDisplayLayer *, NSError *);
- void rendererDidReceiveError(AVSampleBufferAudioRenderer *, NSError *);
-
private:
explicit SourceBufferPrivateAVFObjC(MediaSourcePrivateAVFObjC*);
@@ -132,7 +118,6 @@
Vector<RefPtr<VideoTrackPrivateMediaSourceAVFObjC>> m_videoTracks;
Vector<RefPtr<AudioTrackPrivateMediaSourceAVFObjC>> m_audioTracks;
- Vector<SourceBufferPrivateAVFObjCErrorClient*> m_errorClients;
WeakPtrFactory<SourceBufferPrivateAVFObjC> m_weakFactory;
@@ -141,7 +126,6 @@
RetainPtr<AVSampleBufferDisplayLayer> m_displayLayer;
std::map<int, RetainPtr<AVSampleBufferAudioRenderer>> m_audioRenderers;
RetainPtr<WebAVStreamDataParserListener> m_delegate;
- RetainPtr<WebAVSampleBufferErrorListener> m_errorListener;
MediaSourcePrivateAVFObjC* m_mediaSource;
SourceBufferPrivateClient* m_client;
Modified: tags/Safari-538.39.41/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm (169869 => 169870)
--- tags/Safari-538.39.41/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm 2014-06-12 02:03:34 UTC (rev 169869)
+++ tags/Safari-538.39.41/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm 2014-06-12 02:10:01 UTC (rev 169870)
@@ -79,8 +79,6 @@
SOFT_LINK_CONSTANT(AVFoundation, AVMediaCharacteristicVisual, NSString*)
SOFT_LINK_CONSTANT(AVFoundation, AVMediaCharacteristicAudible, NSString*)
SOFT_LINK_CONSTANT(AVFoundation, AVMediaCharacteristicLegible, NSString*)
-SOFT_LINK_CONSTANT(AVFoundation, AVSampleBufferDisplayLayerFailedToDecodeNotification, NSString*)
-SOFT_LINK_CONSTANT(AVFoundation, AVSampleBufferDisplayLayerFailedToDecodeNotificationErrorKey, NSString*)
SOFT_LINK(CoreMedia, CMFormatDescriptionGetMediaType, CMMediaType, (CMFormatDescriptionRef desc), (desc))
SOFT_LINK(CoreMedia, CMSampleBufferCreate, OSStatus, (CFAllocatorRef allocator, CMBlockBufferRef dataBuffer, Boolean dataReady, CMSampleBufferMakeDataReadyCallback makeDataReadyCallback, void *makeDataReadyRefcon, CMFormatDescriptionRef formatDescription, CMItemCount numSamples, CMItemCount numSampleTimingEntries, const CMSampleTimingInfo *sampleTimingArray, CMItemCount numSampleSizeEntries, const size_t *sampleSizeArray, CMSampleBufferRef *sBufOut), (allocator, dataBuffer, dataReady, makeDataReadyCallback, makeDataReadyRefcon, formatDescription, numSamples, numSampleTimingEntries, sampleTimingArray, numSampleSizeEntries, sampleSizeArray, sBufOut))
@@ -99,8 +97,6 @@
#define AVMediaTypeVideo getAVMediaTypeVideo()
#define AVMediaTypeAudio getAVMediaTypeAudio()
#define AVMediaTypeText getAVMediaTypeText()
-#define AVSampleBufferDisplayLayerFailedToDecodeNotification getAVSampleBufferDisplayLayerFailedToDecodeNotification()
-#define AVSampleBufferDisplayLayerFailedToDecodeNotificationErrorKey getAVSampleBufferDisplayLayerFailedToDecodeNotificationErrorKey()
#define kCMTimeZero getkCMTimeZero()
#define kCMTimeInvalid getkCMTimeInvalid()
#define kCMSampleAttachmentKey_NotSync getkCMSampleAttachmentKey_NotSync()
@@ -283,139 +279,6 @@
}
@end
-@interface WebAVSampleBufferErrorListener : NSObject {
- WebCore::SourceBufferPrivateAVFObjC* _parent;
- Vector<RetainPtr<AVSampleBufferDisplayLayer>> _layers;
- Vector<RetainPtr<AVSampleBufferAudioRenderer>> _renderers;
-}
-
-- (id)initWithParent:(WebCore::SourceBufferPrivateAVFObjC*)parent;
-- (void)invalidate;
-- (void)beginObservingLayer:(AVSampleBufferDisplayLayer *)layer;
-- (void)stopObservingLayer:(AVSampleBufferDisplayLayer *)layer;
-- (void)beginObservingRenderer:(AVSampleBufferAudioRenderer *)renderer;
-- (void)stopObservingRenderer:(AVSampleBufferAudioRenderer *)renderer;
-@end
-
-@implementation WebAVSampleBufferErrorListener
-
-- (id)initWithParent:(WebCore::SourceBufferPrivateAVFObjC*)parent
-{
- if (!(self = [super init]))
- return nil;
-
- _parent = parent;
- return self;
-}
-
-- (void)dealloc
-{
- [self invalidate];
- [super dealloc];
-}
-
-- (void)invalidate
-{
- if (!_parent && !_layers.size() && !_renderers.size())
- return;
-
- for (auto& layer : _layers)
- [layer removeObserver:self forKeyPath:@"error"];
- _layers.clear();
-
- for (auto& renderer : _renderers)
- [renderer removeObserver:self forKeyPath:@"error"];
- _renderers.clear();
-
- [[NSNotificationCenter defaultCenter] removeObserver:self];
-
- _parent = nullptr;
-}
-
-- (void)beginObservingLayer:(AVSampleBufferDisplayLayer*)layer
-{
- ASSERT(_parent);
- ASSERT(!_layers.contains(layer));
-
- _layers.append(layer);
- [layer addObserver:self forKeyPath:@"error" options:NSKeyValueObservingOptionNew context:nullptr];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(layerFailedToDecode:) name:AVSampleBufferDisplayLayerFailedToDecodeNotification object:layer];
-}
-
-- (void)stopObservingLayer:(AVSampleBufferDisplayLayer*)layer
-{
- ASSERT(_parent);
- ASSERT(_layers.contains(layer));
-
- [layer removeObserver:self forKeyPath:@"error"];
- _layers.remove(_layers.find(layer));
-
- [[NSNotificationCenter defaultCenter] removeObserver:self name:AVSampleBufferDisplayLayerFailedToDecodeNotification object:layer];
-}
-
-- (void)beginObservingRenderer:(AVSampleBufferAudioRenderer*)renderer
-{
- ASSERT(_parent);
- ASSERT(!_renderers.contains(renderer));
-
- _renderers.append(renderer);
- [renderer addObserver:self forKeyPath:@"error" options:NSKeyValueObservingOptionNew context:nullptr];
-}
-
-- (void)stopObservingRenderer:(AVSampleBufferAudioRenderer*)renderer
-{
- ASSERT(_parent);
- ASSERT(_renderers.contains(renderer));
-
- [renderer removeObserver:self forKeyPath:@"error"];
- _renderers.remove(_renderers.find(renderer));
-}
-
-- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
-{
- UNUSED_PARAM(context);
- UNUSED_PARAM(keyPath);
- ASSERT(_parent);
-
- RetainPtr<WebAVSampleBufferErrorListener> strongSelf = self;
- if ([object isKindOfClass:getAVSampleBufferDisplayLayerClass()]) {
- RetainPtr<AVSampleBufferDisplayLayer> layer = (AVSampleBufferDisplayLayer *)object;
- RetainPtr<NSError> error = [change valueForKey:NSKeyValueChangeNewKey];
-
- ASSERT(_layers.contains(layer.get()));
- ASSERT([keyPath isEqualTo:@"error"]);
-
- callOnMainThread([strongSelf, layer, error] {
- strongSelf->_parent->layerDidReceiveError(layer.get(), error.get());
- });
- } else if ([object isKindOfClass:getAVSampleBufferAudioRendererClass()]) {
- RetainPtr<AVSampleBufferAudioRenderer> renderer = (AVSampleBufferAudioRenderer *)object;
- RetainPtr<NSError> error = [change valueForKey:NSKeyValueChangeNewKey];
-
- ASSERT(_renderers.contains(renderer.get()));
- ASSERT([keyPath isEqualTo:@"error"]);
-
- callOnMainThread([strongSelf, renderer, error] {
- strongSelf->_parent->rendererDidReceiveError(renderer.get(), error.get());
- });
- } else
- ASSERT_NOT_REACHED();
-}
-
-- (void)layerFailedToDecode:(NSNotification*)note
-{
- RetainPtr<AVSampleBufferDisplayLayer> layer = (AVSampleBufferDisplayLayer *)[note object];
- ASSERT(_layers.contains(layer.get()));
-
- RetainPtr<NSError> error = [[note userInfo] valueForKey:AVSampleBufferDisplayLayerFailedToDecodeNotificationErrorKey];
-
- RetainPtr<WebAVSampleBufferErrorListener> strongSelf = self;
- callOnMainThread([strongSelf, layer, error] {
- strongSelf->_parent->layerDidReceiveError(layer.get(), error.get());
- });
-}
-@end
-
namespace WebCore {
#pragma mark -
@@ -537,7 +400,6 @@
: m_weakFactory(this)
, m_parser(adoptNS([[getAVStreamDataParserClass() alloc] init]))
, m_delegate(adoptNS([[WebAVStreamDataParserListener alloc] initWithParser:m_parser.get() parent:createWeakPtr()]))
- , m_errorListener(adoptNS([[WebAVSampleBufferErrorListener alloc] initWithParent:this]))
, m_mediaSource(parent)
, m_client(0)
, m_parsingSucceeded(true)
@@ -797,7 +659,6 @@
[m_displayLayer requestMediaDataWhenReadyOnQueue:dispatch_get_main_queue() usingBlock:^{
didBecomeReadyForMoreSamples(trackID);
}];
- [m_errorListener beginObservingLayer:m_displayLayer.get()];
}
if (m_mediaSource)
m_mediaSource->player()->addDisplayLayer(m_displayLayer.get());
@@ -822,7 +683,6 @@
didBecomeReadyForMoreSamples(trackID);
}];
m_audioRenderers[trackID] = renderer;
- [m_errorListener beginObservingRenderer:renderer.get()];
} else
renderer = m_audioRenderers[trackID].get();
@@ -831,37 +691,6 @@
}
}
-void SourceBufferPrivateAVFObjC::registerForErrorNotifications(SourceBufferPrivateAVFObjCErrorClient* client)
-{
- ASSERT(!m_errorClients.contains(client));
- m_errorClients.append(client);
-}
-
-void SourceBufferPrivateAVFObjC::unregisterForErrorNotifications(SourceBufferPrivateAVFObjCErrorClient* client)
-{
- ASSERT(m_errorClients.contains(client));
- m_errorClients.remove(m_errorClients.find(client));
-}
-
-void SourceBufferPrivateAVFObjC::layerDidReceiveError(AVSampleBufferDisplayLayer *layer, NSError *error)
-{
- LOG(Media, "SourceBufferPrivateAVFObjC::layerDidReceiveError(%p): layer(%p), error(%@)", this, layer, [error description]);
- for (auto& client : m_errorClients)
- client->layerDidReceiveError(layer, error);
-
- int errorCode = [[[error userInfo] valueForKey:@"OSStatus"] intValue];
-
- if (m_client)
- m_client->sourceBufferPrivateDidReceiveRenderingError(this, errorCode);
-}
-
-void SourceBufferPrivateAVFObjC::rendererDidReceiveError(AVSampleBufferAudioRenderer *renderer, NSError *error)
-{
- LOG(Media, "SourceBufferPrivateAVFObjC::rendererDidReceiveError(%p): renderer(%p), error(%@)", this, renderer, [error description]);
- for (auto& client : m_errorClients)
- client->rendererDidReceiveError(renderer, error);
-}
-
static RetainPtr<CMSampleBufferRef> createNonDisplayingCopy(CMSampleBufferRef sampleBuffer)
{
CMSampleBufferRef newSampleBuffer = 0;