49
49
#import < pal/avfoundation/MediaTimeAVFoundation.h>
50
50
#import < pal/spi/cocoa/AVFoundationSPI.h>
51
51
#import < wtf/BlockObjCExceptions.h>
52
+ #import < wtf/WeakObjCPtr.h>
52
53
#import < wtf/cf/TypeCastsCF.h>
53
54
#import < wtf/text/MakeString.h>
54
55
@@ -65,10 +66,10 @@ @interface AVContentKeySpecifier (WebCorePrivate)
65
66
#endif
66
67
67
68
@interface WebAVStreamDataParserListener : NSObject <AVStreamDataParserOutputHandling> {
68
- WebCore::SourceBufferParserAVFObjC* _parent;
69
- AVStreamDataParser* _parser;
69
+ ThreadSafeWeakPtr< WebCore::SourceBufferParserAVFObjC> _parent;
70
+ WeakObjCPtr< AVStreamDataParser> _parser;
70
71
}
71
- @property (assign ) WebCore::SourceBufferParserAVFObjC* parent;
72
+ @property (assign ) ThreadSafeWeakPtr< WebCore::SourceBufferParserAVFObjC> parent;
72
73
- (id )initWithParser : (AVStreamDataParser*)parser parent : (WebCore::SourceBufferParserAVFObjC*)parent ;
73
74
@end
74
75
@@ -102,43 +103,43 @@ - (void)invalidate
102
103
103
104
- (void )streamDataParser : (AVStreamDataParser *)streamDataParser didParseStreamDataAsAsset : (AVAsset *)asset
104
105
{
105
- ASSERT_UNUSED (streamDataParser, streamDataParser == _parser);
106
- _parent->didParseStreamDataAsAsset (asset);
106
+ ASSERT_UNUSED (streamDataParser, streamDataParser == _parser. get () );
107
+ _parent. get () ->didParseStreamDataAsAsset (asset);
107
108
}
108
109
109
110
- (void )streamDataParser : (AVStreamDataParser *)streamDataParser didParseStreamDataAsAsset : (AVAsset *)asset withDiscontinuity : (BOOL )discontinuity
110
111
{
111
112
UNUSED_PARAM (discontinuity);
112
- ASSERT_UNUSED (streamDataParser, streamDataParser == _parser);
113
- _parent->didParseStreamDataAsAsset (asset);
113
+ ASSERT_UNUSED (streamDataParser, streamDataParser == _parser. get () );
114
+ _parent. get () ->didParseStreamDataAsAsset (asset);
114
115
}
115
116
116
117
- (void )streamDataParser : (AVStreamDataParser *)streamDataParser didFailToParseStreamDataWithError : (NSError *)error
117
118
{
118
- ASSERT_UNUSED (streamDataParser, streamDataParser == _parser);
119
- _parent->didFailToParseStreamDataWithError (error);
119
+ ASSERT_UNUSED (streamDataParser, streamDataParser == _parser. get () );
120
+ _parent. get () ->didFailToParseStreamDataWithError (error);
120
121
}
121
122
122
123
- (void )streamDataParser : (AVStreamDataParser *)streamDataParser didProvideMediaData : (CMSampleBufferRef)sample forTrackID : (CMPersistentTrackID)trackID mediaType : (NSString *)nsMediaType flags : (AVStreamDataParserOutputMediaDataFlags)flags
123
124
{
124
- ASSERT_UNUSED (streamDataParser, streamDataParser == _parser);
125
- _parent->didProvideMediaDataForTrackID (trackID, sample, nsMediaType, flags);
125
+ ASSERT_UNUSED (streamDataParser, streamDataParser == _parser. get () );
126
+ _parent. get () ->didProvideMediaDataForTrackID (trackID, sample, nsMediaType, flags);
126
127
}
127
128
128
129
ALLOW_DEPRECATED_IMPLEMENTATIONS_BEGIN
129
130
- (void )streamDataParserWillProvideContentKeyRequestInitializationData : (AVStreamDataParser *)streamDataParser forTrackID : (CMPersistentTrackID)trackID
130
131
ALLOW_DEPRECATED_IMPLEMENTATIONS_END
131
132
{
132
- ASSERT_UNUSED (streamDataParser, streamDataParser == _parser);
133
- _parent->willProvideContentKeyRequestInitializationDataForTrackID (trackID);
133
+ ASSERT_UNUSED (streamDataParser, streamDataParser == _parser. get () );
134
+ _parent. get () ->willProvideContentKeyRequestInitializationDataForTrackID (trackID);
134
135
}
135
136
136
137
ALLOW_DEPRECATED_IMPLEMENTATIONS_BEGIN
137
138
- (void )streamDataParser : (AVStreamDataParser *)streamDataParser didProvideContentKeyRequestInitializationData : (NSData *)initData forTrackID : (CMPersistentTrackID)trackID
138
139
ALLOW_DEPRECATED_IMPLEMENTATIONS_END
139
140
{
140
- ASSERT_UNUSED (streamDataParser, streamDataParser == _parser);
141
- _parent->didProvideContentKeyRequestInitializationDataForTrackID (initData, trackID);
141
+ ASSERT_UNUSED (streamDataParser, streamDataParser == _parser. get () );
142
+ _parent. get () ->didProvideContentKeyRequestInitializationDataForTrackID (initData, trackID);
142
143
}
143
144
144
145
@end
@@ -150,9 +151,9 @@ @interface WebAVStreamDataParserWithKeySpecifierListener : WebAVStreamDataParser
150
151
@implementation WebAVStreamDataParserWithKeySpecifierListener
151
152
- (void )streamDataParser : (AVStreamDataParser *)streamDataParser didProvideContentKeySpecifier : (AVContentKeySpecifier *)keySpecifier forTrackID : (CMPersistentTrackID)trackID
152
153
{
153
- ASSERT_UNUSED (streamDataParser, streamDataParser == _parser);
154
+ ASSERT_UNUSED (streamDataParser, streamDataParser == _parser. get () );
154
155
if ([keySpecifier respondsToSelector: @selector (initializationData )])
155
- _parent->didProvideContentKeyRequestSpecifierForTrackID (keySpecifier.initializationData , trackID);
156
+ _parent. get () ->didProvideContentKeyRequestSpecifierForTrackID (keySpecifier.initializationData , trackID);
156
157
}
157
158
@end
158
159
#endif
0 commit comments