Changeset 169099 in webkit
- Timestamp:
- May 19, 2014, 7:56:33 PM (12 years ago)
- Location:
- branches/safari-538.34-branch/Source/WebCore
- Files:
-
- 6 edited
-
ChangeLog (modified) (1 diff)
-
Modules/mediasource/SourceBuffer.cpp (modified) (2 diffs)
-
Modules/mediasource/SourceBuffer.h (modified) (1 diff)
-
platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm (modified) (3 diffs)
-
platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h (modified) (2 diffs)
-
platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-538.34-branch/Source/WebCore/ChangeLog
r169076 r169099 1 2014-05-19 Matthew Hanson <matthew_hanson@apple.com> 2 3 Rollout r169074. 4 1 5 2014-05-19 Matthew Hanson <matthew_hanson@apple.com> 2 6 -
branches/safari-538.34-branch/Source/WebCore/Modules/mediasource/SourceBuffer.cpp
r169074 r169099 108 108 , m_removeTimer(this, &SourceBuffer::removeTimerFired) 109 109 { 110 ASSERT(m_private); 110 111 ASSERT(m_source); 111 112 … … 474 475 // 1. Loop Top: If the input buffer is empty, then jump to the need more data step below. 475 476 if (!m_pendingAppendData.size()) { 476 sourceBufferPrivateAppendComplete( &m_private.get(), AppendSucceeded);477 sourceBufferPrivateAppendComplete(m_private.get(), AppendSucceeded); 477 478 return; 478 479 } -
branches/safari-538.34-branch/Source/WebCore/Modules/mediasource/SourceBuffer.h
r169074 r169099 157 157 void removeCodedFrames(const MediaTime& start, const MediaTime& end); 158 158 159 Ref <SourceBufferPrivate> m_private;159 RefPtr<SourceBufferPrivate> m_private; 160 160 MediaSource* m_source; 161 161 GenericEventQueue m_asyncEventQueue; -
branches/safari-538.34-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm
r169075 r169099 86 86 87 87 pos = m_sourceBuffers.find(buffer); 88 m_sourceBuffers[pos]->clearMediaSource();89 88 m_sourceBuffers.remove(pos); 90 89 } … … 159 158 #endif 160 159 161 static bool MediaSourcePrivateAVFObjCHasAudio(SourceBufferPrivateAVFObjC* sourceBuffer) 162 { 160 static bool MediaSourcePrivateAVFObjCHasAudio(PassRefPtr<SourceBufferPrivateAVFObjC> prpSourceBuffer) 161 { 162 RefPtr<SourceBufferPrivateAVFObjC> sourceBuffer = prpSourceBuffer; 163 163 return sourceBuffer->hasAudio(); 164 164 } … … 169 169 } 170 170 171 static bool MediaSourcePrivateAVFObjCHasVideo(SourceBufferPrivateAVFObjC* sourceBuffer) 172 { 171 static bool MediaSourcePrivateAVFObjCHasVideo(PassRefPtr<SourceBufferPrivateAVFObjC> prpSourceBuffer) 172 { 173 RefPtr<SourceBufferPrivateAVFObjC> sourceBuffer = prpSourceBuffer; 173 174 return sourceBuffer->hasVideo(); 174 175 } -
branches/safari-538.34-branch/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h
r169074 r169099 37 37 #include <wtf/RetainPtr.h> 38 38 #include <wtf/Vector.h> 39 #include <wtf/WeakPtr.h>40 39 #include <wtf/text/AtomicString.h> 41 40 … … 115 114 void destroyRenderers(); 116 115 117 WeakPtr<SourceBufferPrivateAVFObjC> createWeakPtr() { return m_weakFactory.createWeakPtr(); }118 119 116 Vector<RefPtr<VideoTrackPrivateMediaSourceAVFObjC>> m_videoTracks; 120 117 Vector<RefPtr<AudioTrackPrivateMediaSourceAVFObjC>> m_audioTracks; 121 122 WeakPtrFactory<SourceBufferPrivateAVFObjC> m_weakFactory;123 118 124 119 RetainPtr<AVStreamDataParser> m_parser; -
branches/safari-538.34-branch/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm
r169074 r169099 154 154 155 155 @interface WebAVStreamDataParserListener : NSObject { 156 We akPtr<WebCore::SourceBufferPrivateAVFObjC>_parent;156 WebCore::SourceBufferPrivateAVFObjC* _parent; 157 157 AVStreamDataParser* _parser; 158 158 } 159 - (id)initWithParser:(AVStreamDataParser*)parser parent:(We akPtr<WebCore::SourceBufferPrivateAVFObjC>)parent;159 - (id)initWithParser:(AVStreamDataParser*)parser parent:(WebCore::SourceBufferPrivateAVFObjC*)parent; 160 160 @end 161 161 162 162 @implementation WebAVStreamDataParserListener 163 - (id)initWithParser:(AVStreamDataParser*)parser parent:(We akPtr<WebCore::SourceBufferPrivateAVFObjC>)parent163 - (id)initWithParser:(AVStreamDataParser*)parser parent:(WebCore::SourceBufferPrivateAVFObjC*)parent 164 164 { 165 165 self = [super init]; … … 183 183 { 184 184 [_parser setDelegate:nil]; 185 _parent = nullptr; 185 186 _parser = nullptr; 186 187 } … … 192 193 #endif 193 194 ASSERT(streamDataParser == _parser); 194 RetainPtr<WebAVStreamDataParserListener> strongSelf = self; 195 RefPtr<WebCore::SourceBufferPrivateAVFObjC> strongParent = _parent; 196 if (!strongParent) 197 return; 195 198 196 199 RetainPtr<AVAsset*> strongAsset = asset; 197 callOnMainThread([strongSelf, strongAsset] { 198 if (strongSelf->_parent) 199 strongSelf->_parent->didParseStreamDataAsAsset(strongAsset.get()); 200 callOnMainThread([strongParent, strongAsset] { 201 strongParent->didParseStreamDataAsAsset(strongAsset.get()); 200 202 }); 201 203 } … … 208 210 #endif 209 211 ASSERT(streamDataParser == _parser); 210 RetainPtr<WebAVStreamDataParserListener> strongSelf = self; 212 RefPtr<WebCore::SourceBufferPrivateAVFObjC> strongParent = _parent; 213 if (!strongParent) 214 return; 211 215 212 216 RetainPtr<AVAsset*> strongAsset = asset; 213 callOnMainThread([strongSelf, strongAsset] { 214 if (strongSelf->_parent) 215 strongSelf->_parent->didParseStreamDataAsAsset(strongAsset.get()); 217 callOnMainThread([strongParent, strongAsset] { 218 strongParent->didParseStreamDataAsAsset(strongAsset.get()); 216 219 }); 217 220 } … … 223 226 #endif 224 227 ASSERT(streamDataParser == _parser); 225 RetainPtr<WebAVStreamDataParserListener> strongSelf = self; 228 RefPtr<WebCore::SourceBufferPrivateAVFObjC> strongParent = _parent; 229 if (!strongParent) 230 return; 226 231 227 232 RetainPtr<NSError> strongError = error; 228 callOnMainThread([strongSelf, strongError] { 229 if (strongSelf->_parent) 230 strongSelf->_parent->didFailToParseStreamDataWithError(strongError.get()); 233 callOnMainThread([strongParent, strongError] { 234 strongParent->didFailToParseStreamDataWithError(strongError.get()); 231 235 }); 232 236 } … … 238 242 #endif 239 243 ASSERT(streamDataParser == _parser); 240 RetainPtr<WebAVStreamDataParserListener> strongSelf = self; 244 RefPtr<WebCore::SourceBufferPrivateAVFObjC> strongParent = _parent; 245 if (!strongParent) 246 return; 241 247 242 248 RetainPtr<CMSampleBufferRef> strongSample = sample; 243 249 String mediaType = nsMediaType; 244 callOnMainThread([strongSelf, strongSample, trackID, mediaType, flags] { 245 if (strongSelf->_parent) 246 strongSelf->_parent->didProvideMediaDataForTrackID(trackID, strongSample.get(), mediaType, flags); 250 callOnMainThread([strongParent, strongSample, trackID, mediaType, flags] { 251 strongParent->didProvideMediaDataForTrackID(trackID, strongSample.get(), mediaType, flags); 247 252 }); 248 253 } … … 254 259 #endif 255 260 ASSERT(streamDataParser == _parser); 256 RetainPtr<WebAVStreamDataParserListener> strongSelf = self; 261 RefPtr<WebCore::SourceBufferPrivateAVFObjC> strongParent = _parent; 262 if (!strongParent) 263 return; 257 264 258 265 String mediaType = nsMediaType; 259 callOnMainThread([strongSelf, trackID, mediaType] { 260 if (strongSelf->_parent) 261 strongSelf->_parent->didReachEndOfTrackWithTrackID(trackID, mediaType); 266 callOnMainThread([strongParent, trackID, mediaType] { 267 strongParent->didReachEndOfTrackWithTrackID(trackID, mediaType); 262 268 }); 263 269 } … … 269 275 #endif 270 276 ASSERT(streamDataParser == _parser); 271 RetainPtr<WebAVStreamDataParserListener> strongSelf = self; 277 RefPtr<WebCore::SourceBufferPrivateAVFObjC> strongParent = _parent; 278 if (!strongParent) 279 return; 272 280 273 281 RetainPtr<NSData> strongData = initData; 274 callOnMainThread([strongSelf, strongData, trackID] { 275 if (strongSelf->_parent) 276 strongSelf->_parent->didProvideContentKeyRequestInitializationDataForTrackID(strongData.get(), trackID); 282 callOnMainThread([strongParent, strongData, trackID] { 283 strongParent->didProvideContentKeyRequestInitializationDataForTrackID(strongData.get(), trackID); 277 284 }); 278 285 } … … 380 387 381 388 SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC(MediaSourcePrivateAVFObjC* parent) 382 : m_weakFactory(this) 383 , m_parser(adoptNS([[getAVStreamDataParserClass() alloc] init])) 384 , m_delegate(adoptNS([[WebAVStreamDataParserListener alloc] initWithParser:m_parser.get() parent:createWeakPtr()])) 389 : m_parser(adoptNS([[getAVStreamDataParserClass() alloc] init])) 390 , m_delegate(adoptNS([[WebAVStreamDataParserListener alloc] initWithParser:m_parser.get() parent:this])) 385 391 , m_mediaSource(parent) 386 392 , m_client(0) … … 393 399 SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC() 394 400 { 395 ASSERT(!m_client);396 401 destroyParser(); 397 402 destroyRenderers(); … … 465 470 LOG(Media, "SourceBufferPrivateAVFObjC::processCodedFrame(%p) - size change detected: {width=%lf, height=%lf", formatSize.width(), formatSize.height()); 466 471 m_cachedSize = formatSize; 467 if (m_mediaSource) 468 m_mediaSource->player()->sizeChanged(); 472 m_mediaSource->player()->sizeChanged(); 469 473 } 470 474 } … … 484 488 void SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID(NSData* initData, int trackID) 485 489 { 486 if (!m_mediaSource)487 return;488 489 490 UNUSED_PARAM(trackID); 490 491 #if ENABLE(ENCRYPTED_MEDIA_V2) … … 519 520 520 521 RetainPtr<NSData> nsData = adoptNS([[NSData alloc] initWithBytes:data length:length]); 521 WeakPtr<SourceBufferPrivateAVFObjC> weakThis = createWeakPtr(); 522 RetainPtr<AVStreamDataParser> parser = m_parser; 523 RetainPtr<WebAVStreamDataParserListener> delegate = m_delegate; 522 RefPtr<SourceBufferPrivateAVFObjC> strongThis = this; 524 523 525 524 m_parsingSucceeded = true; 526 525 527 dispatch_async(globalDataParserQueue(), [nsData, weakThis, parser, delegate] { 528 529 [parser appendStreamData:nsData.get()]; 530 531 callOnMainThread([weakThis] { 532 if (weakThis) 533 weakThis->appendCompleted(); 526 dispatch_async(globalDataParserQueue(), [nsData, strongThis] { 527 [strongThis->m_parser appendStreamData:nsData.get()]; 528 529 callOnMainThread([strongThis] { 530 strongThis->appendCompleted(); 534 531 }); 535 532 });
Note:
See TracChangeset
for help on using the changeset viewer.