Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,6 @@ platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm
platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm
platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm
platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm
platform/graphics/avfoundation/objc/SourceBufferParserAVFObjC.mm
platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm
platform/graphics/avfoundation/objc/WebAVContentKeyGroup.mm
platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ namespace WebCore {

class SourceBufferParserAVFObjC final
: public SourceBufferParser
, public CanMakeWeakPtr<SourceBufferParserAVFObjC>
, private LoggerHelper {
public:
static MediaPlayerEnums::SupportsType isContentTypeSupported(const ContentType&);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#import <pal/avfoundation/MediaTimeAVFoundation.h>
#import <pal/spi/cocoa/AVFoundationSPI.h>
#import <wtf/BlockObjCExceptions.h>
#import <wtf/WeakObjCPtr.h>
#import <wtf/cf/TypeCastsCF.h>
#import <wtf/text/MakeString.h>

Expand All @@ -65,10 +66,10 @@ @interface AVContentKeySpecifier (WebCorePrivate)
#endif

@interface WebAVStreamDataParserListener : NSObject<AVStreamDataParserOutputHandling> {
WebCore::SourceBufferParserAVFObjC* _parent;
AVStreamDataParser* _parser;
ThreadSafeWeakPtr<WebCore::SourceBufferParserAVFObjC> _parent;
WeakObjCPtr<AVStreamDataParser> _parser;
}
@property (assign) WebCore::SourceBufferParserAVFObjC* parent;
@property (assign) ThreadSafeWeakPtr<WebCore::SourceBufferParserAVFObjC> parent;
- (id)initWithParser:(AVStreamDataParser*)parser parent:(WebCore::SourceBufferParserAVFObjC*)parent;
@end

Expand Down Expand Up @@ -102,43 +103,43 @@ - (void)invalidate

- (void)streamDataParser:(AVStreamDataParser *)streamDataParser didParseStreamDataAsAsset:(AVAsset *)asset
{
ASSERT_UNUSED(streamDataParser, streamDataParser == _parser);
_parent->didParseStreamDataAsAsset(asset);
ASSERT_UNUSED(streamDataParser, streamDataParser == _parser.get());
_parent.get()->didParseStreamDataAsAsset(asset);
}

- (void)streamDataParser:(AVStreamDataParser *)streamDataParser didParseStreamDataAsAsset:(AVAsset *)asset withDiscontinuity:(BOOL)discontinuity
{
UNUSED_PARAM(discontinuity);
ASSERT_UNUSED(streamDataParser, streamDataParser == _parser);
_parent->didParseStreamDataAsAsset(asset);
ASSERT_UNUSED(streamDataParser, streamDataParser == _parser.get());
_parent.get()->didParseStreamDataAsAsset(asset);
}

- (void)streamDataParser:(AVStreamDataParser *)streamDataParser didFailToParseStreamDataWithError:(NSError *)error
{
ASSERT_UNUSED(streamDataParser, streamDataParser == _parser);
_parent->didFailToParseStreamDataWithError(error);
ASSERT_UNUSED(streamDataParser, streamDataParser == _parser.get());
_parent.get()->didFailToParseStreamDataWithError(error);
}

- (void)streamDataParser:(AVStreamDataParser *)streamDataParser didProvideMediaData:(CMSampleBufferRef)sample forTrackID:(CMPersistentTrackID)trackID mediaType:(NSString *)nsMediaType flags:(AVStreamDataParserOutputMediaDataFlags)flags
{
ASSERT_UNUSED(streamDataParser, streamDataParser == _parser);
_parent->didProvideMediaDataForTrackID(trackID, sample, nsMediaType, flags);
ASSERT_UNUSED(streamDataParser, streamDataParser == _parser.get());
_parent.get()->didProvideMediaDataForTrackID(trackID, sample, nsMediaType, flags);
}

ALLOW_DEPRECATED_IMPLEMENTATIONS_BEGIN
- (void)streamDataParserWillProvideContentKeyRequestInitializationData:(AVStreamDataParser *)streamDataParser forTrackID:(CMPersistentTrackID)trackID
ALLOW_DEPRECATED_IMPLEMENTATIONS_END
{
ASSERT_UNUSED(streamDataParser, streamDataParser == _parser);
_parent->willProvideContentKeyRequestInitializationDataForTrackID(trackID);
ASSERT_UNUSED(streamDataParser, streamDataParser == _parser.get());
_parent.get()->willProvideContentKeyRequestInitializationDataForTrackID(trackID);
}

ALLOW_DEPRECATED_IMPLEMENTATIONS_BEGIN
- (void)streamDataParser:(AVStreamDataParser *)streamDataParser didProvideContentKeyRequestInitializationData:(NSData *)initData forTrackID:(CMPersistentTrackID)trackID
ALLOW_DEPRECATED_IMPLEMENTATIONS_END
{
ASSERT_UNUSED(streamDataParser, streamDataParser == _parser);
_parent->didProvideContentKeyRequestInitializationDataForTrackID(initData, trackID);
ASSERT_UNUSED(streamDataParser, streamDataParser == _parser.get());
_parent.get()->didProvideContentKeyRequestInitializationDataForTrackID(initData, trackID);
}

@end
Expand All @@ -150,9 +151,9 @@ @interface WebAVStreamDataParserWithKeySpecifierListener : WebAVStreamDataParser
@implementation WebAVStreamDataParserWithKeySpecifierListener
- (void)streamDataParser:(AVStreamDataParser *)streamDataParser didProvideContentKeySpecifier:(AVContentKeySpecifier *)keySpecifier forTrackID:(CMPersistentTrackID)trackID
{
ASSERT_UNUSED(streamDataParser, streamDataParser == _parser);
ASSERT_UNUSED(streamDataParser, streamDataParser == _parser.get());
if ([keySpecifier respondsToSelector:@selector(initializationData)])
_parent->didProvideContentKeyRequestSpecifierForTrackID(keySpecifier.initializationData, trackID);
_parent.get()->didProvideContentKeyRequestSpecifierForTrackID(keySpecifier.initializationData, trackID);
}
@end
#endif
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/platform/graphics/cocoa/SourceBufferParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <variant>
#include <wtf/Expected.h>
#include <wtf/RefCounted.h>
#include <wtf/ThreadSafeRefCounted.h>
#include <wtf/ThreadSafeWeakPtr.h>

namespace WTF {
class Logger;
Expand All @@ -47,7 +47,7 @@ class MediaSampleAVFObjC;
class SharedBuffer;
struct TrackInfo;

class WEBCORE_EXPORT SourceBufferParser : public ThreadSafeRefCounted<SourceBufferParser, WTF::DestructionThread::Main> {
class WEBCORE_EXPORT SourceBufferParser : public ThreadSafeRefCountedAndCanMakeThreadSafeWeakPtr<SourceBufferParser, WTF::DestructionThread::Main> {
public:
static MediaPlayerEnums::SupportsType isContentTypeSupported(const ContentType&);

Expand Down