2 * Copyright (C) 2013 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 #import "SourceBufferPrivateAVFObjC.h"
29 #if ENABLE(MEDIA_SOURCE) && USE(AVFOUNDATION)
31 #import "ExceptionCodePlaceholder.h"
33 #import "MediaDescription.h"
34 #import "MediaPlayerPrivateMediaSourceAVFObjC.h"
35 #import "MediaSample.h"
36 #import "MediaSourcePrivateAVFObjC.h"
37 #import "MediaTimeMac.h"
38 #import "NotImplemented.h"
39 #import "SoftLinking.h"
40 #import "SourceBufferPrivateClient.h"
41 #import "TimeRanges.h"
42 #import "AudioTrackPrivateMediaSourceAVFObjC.h"
43 #import "VideoTrackPrivateMediaSourceAVFObjC.h"
44 #import "InbandTextTrackPrivateAVFObjC.h"
45 #import <AVFoundation/AVAssetTrack.h>
46 #import <AVFoundation/AVSampleBufferDisplayLayer.h>
47 #import <objc/runtime.h>
48 #import <wtf/text/AtomicString.h>
49 #import <wtf/text/CString.h>
50 #import <wtf/HashCountedSet.h>
51 #import <wtf/WeakPtr.h>
55 #pragma mark Soft Linking
57 SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation)
58 SOFT_LINK_FRAMEWORK_OPTIONAL(CoreMedia)
60 SOFT_LINK_CLASS(AVFoundation, AVAssetTrack)
61 SOFT_LINK_CLASS(AVFoundation, AVStreamDataParser)
62 SOFT_LINK_CLASS(AVFoundation, AVSampleBufferDisplayLayer)
64 SOFT_LINK_POINTER_OPTIONAL(AVFoundation, AVMediaTypeVideo, NSString *)
65 SOFT_LINK_POINTER_OPTIONAL(AVFoundation, AVMediaTypeAudio, NSString *)
66 SOFT_LINK_POINTER_OPTIONAL(AVFoundation, AVMediaTypeText, NSString *)
68 SOFT_LINK_CONSTANT(CoreMedia, kCMTimeZero, CMTime);
69 SOFT_LINK_CONSTANT(CoreMedia, kCMTimeInvalid, CMTime);
70 SOFT_LINK_CONSTANT(CoreMedia, kCMSampleAttachmentKey_DoNotDisplay, CFStringRef)
71 SOFT_LINK_CONSTANT(CoreMedia, kCMSampleAttachmentKey_NotSync, CFStringRef)
72 SOFT_LINK_CONSTANT(CoreMedia, kCMSampleBufferAttachmentKey_DrainAfterDecoding, CFStringRef)
73 SOFT_LINK_CONSTANT(CoreMedia, kCMSampleBufferAttachmentKey_ResetDecoderBeforeDecoding, CFStringRef)
74 SOFT_LINK_CONSTANT(CoreMedia, kCMSampleBufferAttachmentKey_EmptyMedia, CFStringRef)
75 SOFT_LINK_CONSTANT(CoreMedia, kCMSampleBufferAttachmentKey_DisplayEmptyMediaImmediately, CFStringRef)
77 SOFT_LINK_CONSTANT(AVFoundation, AVMediaCharacteristicVisual, NSString*)
78 SOFT_LINK_CONSTANT(AVFoundation, AVMediaCharacteristicAudible, NSString*)
79 SOFT_LINK_CONSTANT(AVFoundation, AVMediaCharacteristicLegible, NSString*)
81 SOFT_LINK(CoreMedia, CMFormatDescriptionGetMediaType, CMMediaType, (CMFormatDescriptionRef desc), (desc))
82 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))
83 SOFT_LINK(CoreMedia, CMSampleBufferCreateCopy, OSStatus, (CFAllocatorRef allocator, CMSampleBufferRef sbuf, CMSampleBufferRef *sbufCopyOut), (allocator, sbuf, sbufCopyOut))
84 SOFT_LINK(CoreMedia, CMSampleBufferCallForEachSample, OSStatus, (CMSampleBufferRef sbuf, OSStatus (*callback)( CMSampleBufferRef sampleBuffer, CMItemCount index, void *refcon), void *refcon), (sbuf, callback, refcon))
85 SOFT_LINK(CoreMedia, CMSampleBufferGetDecodeTimeStamp, CMTime, (CMSampleBufferRef sbuf), (sbuf))
86 SOFT_LINK(CoreMedia, CMSampleBufferGetDuration, CMTime, (CMSampleBufferRef sbuf), (sbuf))
87 SOFT_LINK(CoreMedia, CMSampleBufferGetPresentationTimeStamp, CMTime, (CMSampleBufferRef sbuf), (sbuf))
88 SOFT_LINK(CoreMedia, CMSampleBufferGetSampleAttachmentsArray, CFArrayRef, (CMSampleBufferRef sbuf, Boolean createIfNecessary), (sbuf, createIfNecessary))
89 SOFT_LINK(CoreMedia, CMFormatDescriptionGetMediaSubType, FourCharCode, (CMFormatDescriptionRef desc), (desc))
90 SOFT_LINK(CoreMedia, CMSetAttachment, void, (CMAttachmentBearerRef target, CFStringRef key, CFTypeRef value, CMAttachmentMode attachmentMode), (target, key, value, attachmentMode))
92 #define AVMediaTypeVideo getAVMediaTypeVideo()
93 #define AVMediaTypeAudio getAVMediaTypeAudio()
94 #define AVMediaTypeText getAVMediaTypeText()
95 #define kCMTimeZero getkCMTimeZero()
96 #define kCMTimeInvalid getkCMTimeInvalid()
97 #define kCMSampleAttachmentKey_NotSync getkCMSampleAttachmentKey_NotSync()
98 #define kCMSampleAttachmentKey_DoNotDisplay getkCMSampleAttachmentKey_DoNotDisplay()
99 #define kCMSampleBufferAttachmentKey_ResetDecoderBeforeDecoding getkCMSampleBufferAttachmentKey_ResetDecoderBeforeDecoding()
100 #define kCMSampleBufferAttachmentKey_DrainAfterDecoding getkCMSampleBufferAttachmentKey_DrainAfterDecoding()
101 #define kCMSampleBufferAttachmentKey_EmptyMedia getkCMSampleBufferAttachmentKey_EmptyMedia()
102 #define kCMSampleBufferAttachmentKey_DisplayEmptyMediaImmediately getkCMSampleBufferAttachmentKey_DisplayEmptyMediaImmediately()
104 #define AVMediaCharacteristicVisual getAVMediaCharacteristicVisual()
105 #define AVMediaCharacteristicAudible getAVMediaCharacteristicAudible()
106 #define AVMediaCharacteristicLegible getAVMediaCharacteristicLegible()
109 #pragma mark AVStreamDataParser
110 @class AVStreamDataParserInternal;
112 NS_CLASS_AVAILABLE(TBD, TBD)
113 @interface AVStreamDataParser : NSObject
114 - (void)setDelegate:(id)delegate;
115 - (void)appendStreamData:(NSData *)data;
116 - (void)setShouldProvideMediaData:(BOOL)shouldProvideMediaData forTrackID:(CMPersistentTrackID)trackID;
117 - (BOOL)shouldProvideMediaDataForTrackID:(CMPersistentTrackID)trackID;
121 #pragma mark WebAVStreamDataParserListener
123 @interface WebAVStreamDataParserListener : NSObject {
124 WebCore::SourceBufferPrivateAVFObjC* _parent;
125 AVStreamDataParser* _parser;
127 - (id)initWithParser:(AVStreamDataParser*)parser parent:(WebCore::SourceBufferPrivateAVFObjC*)parent;
130 @implementation WebAVStreamDataParserListener
131 - (id)initWithParser:(AVStreamDataParser*)parser parent:(WebCore::SourceBufferPrivateAVFObjC*)parent
140 [_parser setDelegate:self];
146 [_parser setDelegate:nil];
150 - (void)streamDataParser:(AVStreamDataParser *)streamDataParser didParseStreamDataAsAsset:(AVAsset *)asset
153 UNUSED_PARAM(streamDataParser);
155 ASSERT(streamDataParser == _parser);
156 _parent->didParseStreamDataAsAsset(asset);
159 - (void)streamDataParser:(AVStreamDataParser *)streamDataParser didFailToParseStreamDataWithError:(NSError *)error
162 UNUSED_PARAM(streamDataParser);
164 ASSERT(streamDataParser == _parser);
165 _parent->didFailToParseStreamDataWithError(error);
168 - (void)streamDataParser:(AVStreamDataParser *)streamDataParser didProvideMediaData:(CMSampleBufferRef)mediaData forTrackID:(CMPersistentTrackID)trackID mediaType:(NSString *)mediaType flags:(NSUInteger)flags
171 UNUSED_PARAM(streamDataParser);
173 ASSERT(streamDataParser == _parser);
174 _parent->didProvideMediaDataForTrackID(trackID, mediaData, mediaType, flags);
177 - (void)streamDataParser:(AVStreamDataParser *)streamDataParser didReachEndOfTrackWithTrackID:(CMPersistentTrackID)trackID mediaType:(NSString *)mediaType
180 UNUSED_PARAM(streamDataParser);
182 ASSERT(streamDataParser == _parser);
183 _parent->didReachEndOfTrackWithTrackID(trackID, mediaType);
190 #pragma mark MediaSampleAVFObjC
192 class MediaSampleAVFObjC FINAL : public MediaSample {
194 static RefPtr<MediaSampleAVFObjC> create(CMSampleBufferRef sample, int trackID) { return adoptRef(new MediaSampleAVFObjC(sample, trackID)); }
195 virtual ~MediaSampleAVFObjC() { }
197 virtual MediaTime presentationTime() const OVERRIDE { return toMediaTime(CMSampleBufferGetPresentationTimeStamp(m_sample.get())); }
198 virtual MediaTime decodeTime() const OVERRIDE { return toMediaTime(CMSampleBufferGetDecodeTimeStamp(m_sample.get())); }
199 virtual MediaTime duration() const OVERRIDE { return toMediaTime(CMSampleBufferGetDuration(m_sample.get())); }
200 virtual AtomicString trackID() const OVERRIDE { return m_id; }
202 virtual SampleFlags flags() const OVERRIDE;
203 virtual PlatformSample platformSample() OVERRIDE;
206 MediaSampleAVFObjC(CMSampleBufferRef sample, int trackID)
208 , m_id(String::format("%d", trackID))
212 RetainPtr<CMSampleBufferRef> m_sample;
216 PlatformSample MediaSampleAVFObjC::platformSample()
218 PlatformSample sample = { PlatformSample::CMSampleBufferType, { .cmSampleBuffer = m_sample.get() } };
222 static bool CMSampleBufferIsRandomAccess(CMSampleBufferRef sample)
224 CFArrayRef attachments = CMSampleBufferGetSampleAttachmentsArray(sample, false);
228 for (CFIndex i = 0, count = CFArrayGetCount(attachments); i < count; ++i) {
229 CFDictionaryRef attachmentDict = (CFDictionaryRef)CFArrayGetValueAtIndex(attachments, i);
230 if (CFDictionaryContainsKey(attachmentDict, kCMSampleAttachmentKey_NotSync))
236 MediaSample::SampleFlags MediaSampleAVFObjC::flags() const
238 int returnValue = MediaSample::None;
240 if (CMSampleBufferIsRandomAccess(m_sample.get()))
241 returnValue |= MediaSample::IsSync;
243 return SampleFlags(returnValue);
247 #pragma mark MediaDescriptionAVFObjC
249 class MediaDescriptionAVFObjC FINAL : public MediaDescription {
251 static RefPtr<MediaDescriptionAVFObjC> create(AVAssetTrack* track) { return adoptRef(new MediaDescriptionAVFObjC(track)); }
252 virtual ~MediaDescriptionAVFObjC() { }
254 virtual AtomicString codec() const OVERRIDE { return m_codec; }
255 virtual bool isVideo() const OVERRIDE { return m_isVideo; }
256 virtual bool isAudio() const OVERRIDE { return m_isAudio; }
257 virtual bool isText() const OVERRIDE { return m_isText; }
260 MediaDescriptionAVFObjC(AVAssetTrack* track)
261 : m_isVideo([track hasMediaCharacteristic:AVMediaCharacteristicVisual])
262 , m_isAudio([track hasMediaCharacteristic:AVMediaCharacteristicAudible])
263 , m_isText([track hasMediaCharacteristic:AVMediaCharacteristicLegible])
265 NSArray* formatDescriptions = [track formatDescriptions];
266 CMFormatDescriptionRef description = [formatDescriptions count] ? (CMFormatDescriptionRef)[formatDescriptions objectAtIndex:0] : 0;
268 FourCharCode codec = CMFormatDescriptionGetMediaSubType(description);
269 m_codec = AtomicString(reinterpret_cast<LChar*>(&codec), 4);
273 AtomicString m_codec;
280 #pragma mark SourceBufferPrivateAVFObjC
282 RefPtr<SourceBufferPrivateAVFObjC> SourceBufferPrivateAVFObjC::create(MediaSourcePrivateAVFObjC* parent)
284 return adoptRef(new SourceBufferPrivateAVFObjC(parent));
287 SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC(MediaSourcePrivateAVFObjC* parent)
288 : m_parser(adoptNS([[getAVStreamDataParserClass() alloc] init]))
289 , m_delegate(adoptNS([[WebAVStreamDataParserListener alloc] initWithParser:m_parser.get() parent:this]))
290 , m_mediaSource(parent)
292 , m_parsingSucceeded(true)
296 SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC()
298 if (m_displayLayer) {
300 m_mediaSource->player()->removeDisplayLayer(m_displayLayer.get());
301 [m_displayLayer flushAndRemoveImage];
302 [m_displayLayer stopRequestingMediaData];
303 m_displayLayer = nullptr;
307 void SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset(AVAsset* asset)
309 LOG(Media, "SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset(%p)", this);
313 SourceBufferPrivateClient::InitializationSegment segment;
314 segment.duration = toMediaTime([m_asset duration]);
316 for (AVAssetTrack* track in [m_asset tracks]) {
317 if ([track hasMediaCharacteristic:AVMediaCharacteristicVisual]) {
318 SourceBufferPrivateClient::InitializationSegment::VideoTrackInformation info;
319 info.track = VideoTrackPrivateMediaSourceAVFObjC::create(track, this);
320 info.description = MediaDescriptionAVFObjC::create(track);
321 segment.videoTracks.append(info);
322 } else if ([track hasMediaCharacteristic:AVMediaCharacteristicAudible]) {
323 SourceBufferPrivateClient::InitializationSegment::AudioTrackInformation info;
324 info.track = AudioTrackPrivateMediaSourceAVFObjC::create(track, this);
325 info.description = MediaDescriptionAVFObjC::create(track);
326 segment.audioTracks.append(info);
329 // FIXME(125161): Add TextTrack support
333 m_client->sourceBufferPrivateDidReceiveInitializationSegment(this, segment);
336 void SourceBufferPrivateAVFObjC::didFailToParseStreamDataWithError(NSError* error)
341 LOG(Media, "SourceBufferPrivateAVFObjC::didFailToParseStreamDataWithError(%p) - error:\"%s\"", this, String([error description]).utf8().data());
343 m_parsingSucceeded = false;
346 struct ProcessCodedFrameInfo {
347 SourceBufferPrivateAVFObjC* sourceBuffer;
349 const String& mediaType;
352 static OSStatus callProcessCodedFrameForEachSample(CMSampleBufferRef sampleBuffer, CMItemCount, void *refcon)
354 ProcessCodedFrameInfo* info = static_cast<ProcessCodedFrameInfo*>(refcon);
355 return info->sourceBuffer->processCodedFrame(info->trackID, sampleBuffer, info->mediaType);
358 void SourceBufferPrivateAVFObjC::didProvideMediaDataForTrackID(int trackID, CMSampleBufferRef sampleBuffer, const String& mediaType, unsigned flags)
362 ProcessCodedFrameInfo info = {this, trackID, mediaType};
363 CMSampleBufferCallForEachSample(sampleBuffer, &callProcessCodedFrameForEachSample, &info);
366 bool SourceBufferPrivateAVFObjC::processCodedFrame(int trackID, CMSampleBufferRef sampleBuffer, const String&)
369 m_client->sourceBufferPrivateDidReceiveSample(this, MediaSampleAVFObjC::create(sampleBuffer, trackID));
374 void SourceBufferPrivateAVFObjC::didReachEndOfTrackWithTrackID(int trackID, const String& mediaType)
376 UNUSED_PARAM(mediaType);
377 UNUSED_PARAM(trackID);
381 void SourceBufferPrivateAVFObjC::setClient(SourceBufferPrivateClient* client)
386 SourceBufferPrivate::AppendResult SourceBufferPrivateAVFObjC::append(const unsigned char* data, unsigned length)
388 m_parsingSucceeded = true;
390 LOG(Media, "SourceBufferPrivateAVFObjC::append(%p) - data:%p, length:%d", this, data, length);
391 [m_parser appendStreamData:[NSData dataWithBytes:data length:length]];
393 if (m_parsingSucceeded && m_mediaSource)
394 m_mediaSource->player()->setLoadingProgresssed(true);
396 return m_parsingSucceeded ? AppendSucceeded : ParsingFailed;
399 void SourceBufferPrivateAVFObjC::abort()
404 void SourceBufferPrivateAVFObjC::removedFromMediaSource()
406 if (m_displayLayer) {
408 m_mediaSource->player()->removeDisplayLayer(m_displayLayer.get());
409 [m_displayLayer flush];
410 [m_displayLayer stopRequestingMediaData];
411 m_displayLayer = nullptr;
415 m_mediaSource->removeSourceBuffer(this);
418 MediaPlayer::ReadyState SourceBufferPrivateAVFObjC::readyState() const
420 return m_mediaSource ? m_mediaSource->player()->readyState() : MediaPlayer::HaveNothing;
423 void SourceBufferPrivateAVFObjC::setReadyState(MediaPlayer::ReadyState readyState)
426 m_mediaSource->player()->setReadyState(readyState);
429 void SourceBufferPrivateAVFObjC::evictCodedFrames()
434 bool SourceBufferPrivateAVFObjC::isFull()
441 bool SourceBufferPrivateAVFObjC::hasVideo() const
446 return m_client->sourceBufferPrivateHasVideo(this);
449 bool SourceBufferPrivateAVFObjC::hasAudio() const
454 return m_client->sourceBufferPrivateHasAudio(this);
457 void SourceBufferPrivateAVFObjC::trackDidChangeEnabled(VideoTrackPrivateMediaSourceAVFObjC* track)
459 int trackID = track->trackID();
460 if (!track->selected() && m_enabledVideoTrackID == trackID) {
461 m_enabledVideoTrackID = -1;
462 [m_parser setShouldProvideMediaData:NO forTrackID:trackID];
464 m_mediaSource->player()->removeDisplayLayer(m_displayLayer.get());
465 } else if (track->selected()) {
466 m_enabledVideoTrackID = trackID;
467 [m_parser setShouldProvideMediaData:YES forTrackID:trackID];
468 if (!m_displayLayer) {
469 m_displayLayer = [[getAVSampleBufferDisplayLayerClass() alloc] init];
470 [m_displayLayer requestMediaDataWhenReadyOnQueue:dispatch_get_main_queue() usingBlock:^{
472 m_client->sourceBufferPrivateDidBecomeReadyForMoreSamples(this);
475 m_mediaSource->player()->addDisplayLayer(m_displayLayer.get());
480 void SourceBufferPrivateAVFObjC::trackDidChangeEnabled(AudioTrackPrivateMediaSourceAVFObjC*)
485 static RetainPtr<CMSampleBufferRef> createNonDisplayingCopy(CMSampleBufferRef sampleBuffer)
487 CMSampleBufferRef newSampleBuffer = 0;
488 CMSampleBufferCreateCopy(kCFAllocatorDefault, sampleBuffer, &newSampleBuffer);
489 if (!newSampleBuffer)
492 CFArrayRef attachmentsArray = CMSampleBufferGetSampleAttachmentsArray(newSampleBuffer, true);
493 for (CFIndex i = 0; i < CFArrayGetCount(attachmentsArray); ++i) {
494 CFMutableDictionaryRef attachments = (CFMutableDictionaryRef)CFArrayGetValueAtIndex(attachmentsArray, i);
495 CFDictionarySetValue(attachments, kCMSampleAttachmentKey_DoNotDisplay, kCFBooleanTrue);
498 return adoptCF(newSampleBuffer);
501 void SourceBufferPrivateAVFObjC::flushAndEnqueueNonDisplayingSamples(Vector<RefPtr<MediaSample>> mediaSamples, AtomicString trackID)
503 if (trackID.toInt() != m_enabledVideoTrackID)
506 LOG(Media, "SourceBufferPrivateAVFObjC::flushAndEnqueueNonDisplayingSamples(%p) samples: %d samples, trackId: %d", this, mediaSamples.size(), trackID.toInt());
508 [m_displayLayer flush];
510 for (auto it = mediaSamples.begin(), end = mediaSamples.end(); it != end; ++it) {
511 RefPtr<MediaSample>& mediaSample = *it;
513 PlatformSample platformSample = mediaSample->platformSample();
514 ASSERT(platformSample.type == PlatformSample::CMSampleBufferType);
516 RetainPtr<CMSampleBufferRef> sampleBuffer = createNonDisplayingCopy(platformSample.sample.cmSampleBuffer);
518 [m_displayLayer enqueueSampleBuffer:sampleBuffer.get()];
522 m_mediaSource->player()->setHasAvailableVideoFrame(false);
525 void SourceBufferPrivateAVFObjC::enqueueSample(PassRefPtr<MediaSample> prpMediaSample, AtomicString trackID)
527 if (trackID.toInt() != m_enabledVideoTrackID)
530 RefPtr<MediaSample> mediaSample = prpMediaSample;
532 PlatformSample platformSample = mediaSample->platformSample();
533 if (platformSample.type != PlatformSample::CMSampleBufferType)
536 [m_displayLayer enqueueSampleBuffer:platformSample.sample.cmSampleBuffer];
538 m_mediaSource->player()->setHasAvailableVideoFrame(true);
541 bool SourceBufferPrivateAVFObjC::isReadyForMoreSamples()
543 return [m_displayLayer isReadyForMoreMediaData];
546 void SourceBufferPrivateAVFObjC::setActive(bool isActive)
549 m_mediaSource->sourceBufferPrivateDidChangeActiveState(this, isActive);
552 MediaTime SourceBufferPrivateAVFObjC::fastSeekTimeForMediaTime(MediaTime time, MediaTime negativeThreshold, MediaTime positiveThreshold)
555 return m_client->sourceBufferPrivateFastSeekTimeForMediaTime(this, time, negativeThreshold, positiveThreshold);
559 void SourceBufferPrivateAVFObjC::seekToTime(MediaTime time)
562 m_client->sourceBufferPrivateSeekToTime(this, time);
567 #endif // ENABLE(MEDIA_SOURCE) && USE(AVFOUNDATION)