Skip to content

Commit 3dc682d

Browse files
[video_player] Use CADisplayLink on macOS 14.0+ (#9533)
Marks the CVDisplayLink-based implementation that was previously used on macOS in all cases with deprecation suppressions, and switches macOS 14+ to share the CADisplayLink-based implementation that is currently used for iOS. Fixes flutter/flutter#171391 ## Pre-Review Checklist [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent 35eaf3e commit 3dc682d

File tree

11 files changed

+97
-85
lines changed

11 files changed

+97
-85
lines changed

packages/video_player/video_player_avfoundation/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
## NEXT
1+
## 2.7.2
22

3+
* Uses `CADisplayLink` on macOS 14.0+.
34
* Updates minimum supported SDK version to Flutter 3.27/Dart 3.6.
45
* Refactors native code for improved testing.
56

packages/video_player/video_player_avfoundation/darwin/RunnerTests/VideoPlayerTests.m

Lines changed: 29 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -137,43 +137,37 @@ - (AVPlayerItemVideoOutput *)videoOutputWithPixelBufferAttributes:
137137

138138
#pragma mark -
139139

140-
/** Test implementation of FVPDisplayLinkFactory that returns a provided display link instance. */
141-
@interface StubFVPDisplayLinkFactory : NSObject <FVPDisplayLinkFactory>
140+
@interface StubFVPDisplayLink : NSObject <FVPDisplayLink>
141+
@property(nonatomic, assign) BOOL running;
142+
@end
142143

144+
@implementation StubFVPDisplayLink
145+
- (CFTimeInterval)duration {
146+
return 1.0 / 60.0;
147+
}
148+
@end
149+
150+
/** Test implementation of FVPDisplayLinkFactory that returns a stub display link instance. */
151+
@interface StubFVPDisplayLinkFactory : NSObject <FVPDisplayLinkFactory>
143152
/** This display link to return. */
144-
@property(nonatomic, strong) FVPDisplayLink *displayLink;
153+
@property(nonatomic, strong) StubFVPDisplayLink *displayLink;
145154
@property(nonatomic, copy) void (^fireDisplayLink)(void);
146-
147-
- (instancetype)initWithDisplayLink:(FVPDisplayLink *)displayLink;
148-
149155
@end
150156

151157
@implementation StubFVPDisplayLinkFactory
152-
- (instancetype)initWithDisplayLink:(FVPDisplayLink *)displayLink {
158+
- (instancetype)init {
153159
self = [super init];
154-
_displayLink = displayLink;
160+
_displayLink = [[StubFVPDisplayLink alloc] init];
155161
return self;
156162
}
157-
- (FVPDisplayLink *)displayLinkWithRegistrar:(id<FlutterPluginRegistrar>)registrar
158-
callback:(void (^)(void))callback {
163+
- (NSObject<FVPDisplayLink> *)displayLinkWithRegistrar:(id<FlutterPluginRegistrar>)registrar
164+
callback:(void (^)(void))callback {
159165
self.fireDisplayLink = callback;
160166
return self.displayLink;
161167
}
162168

163169
@end
164170

165-
/** Non-test implementation of the diplay link factory. */
166-
@interface FVPDefaultDisplayLinkFactory : NSObject <FVPDisplayLinkFactory>
167-
@end
168-
169-
@implementation FVPDefaultDisplayLinkFactory
170-
- (FVPDisplayLink *)displayLinkWithRegistrar:(id<FlutterPluginRegistrar>)registrar
171-
callback:(void (^)(void))callback {
172-
return [[FVPDisplayLink alloc] initWithRegistrar:registrar callback:callback];
173-
}
174-
175-
@end
176-
177171
#pragma mark -
178172

179173
@implementation VideoPlayerTests
@@ -251,12 +245,7 @@ - (void)testPlayerForPlatformViewDoesNotRegisterTexture {
251245
OCMProtocolMock(@protocol(FlutterTextureRegistry));
252246
NSObject<FlutterPluginRegistrar> *registrar = OCMProtocolMock(@protocol(FlutterPluginRegistrar));
253247
OCMStub([registrar textures]).andReturn(mockTextureRegistry);
254-
FVPDisplayLink *mockDisplayLink =
255-
OCMPartialMock([[FVPDisplayLink alloc] initWithRegistrar:registrar
256-
callback:^(){
257-
}]);
258-
StubFVPDisplayLinkFactory *stubDisplayLinkFactory =
259-
[[StubFVPDisplayLinkFactory alloc] initWithDisplayLink:mockDisplayLink];
248+
StubFVPDisplayLinkFactory *stubDisplayLinkFactory = [[StubFVPDisplayLinkFactory alloc] init];
260249
AVPlayerItemVideoOutput *mockVideoOutput = OCMPartialMock([[AVPlayerItemVideoOutput alloc] init]);
261250
FVPVideoPlayerPlugin *videoPlayerPlugin = [[FVPVideoPlayerPlugin alloc]
262251
initWithAVFactory:[[StubFVPAVFactory alloc] initWithPlayer:nil output:mockVideoOutput]
@@ -285,12 +274,7 @@ - (void)testSeekToWhilePausedStartsDisplayLinkTemporarily {
285274
OCMProtocolMock(@protocol(FlutterTextureRegistry));
286275
NSObject<FlutterPluginRegistrar> *registrar = OCMProtocolMock(@protocol(FlutterPluginRegistrar));
287276
OCMStub([registrar textures]).andReturn(mockTextureRegistry);
288-
FVPDisplayLink *mockDisplayLink =
289-
OCMPartialMock([[FVPDisplayLink alloc] initWithRegistrar:registrar
290-
callback:^(){
291-
}]);
292-
StubFVPDisplayLinkFactory *stubDisplayLinkFactory =
293-
[[StubFVPDisplayLinkFactory alloc] initWithDisplayLink:mockDisplayLink];
277+
StubFVPDisplayLinkFactory *stubDisplayLinkFactory = [[StubFVPDisplayLinkFactory alloc] init];
294278
AVPlayerItemVideoOutput *mockVideoOutput = OCMPartialMock([[AVPlayerItemVideoOutput alloc] init]);
295279
FVPVideoPlayerPlugin *videoPlayerPlugin = [[FVPVideoPlayerPlugin alloc]
296280
initWithAVFactory:[[StubFVPAVFactory alloc] initWithPlayer:nil output:mockVideoOutput]
@@ -324,7 +308,7 @@ - (void)testSeekToWhilePausedStartsDisplayLinkTemporarily {
324308
[self waitForExpectationsWithTimeout:30.0 handler:nil];
325309

326310
// Seeking to a new position should start the display link temporarily.
327-
OCMVerify([mockDisplayLink setRunning:YES]);
311+
XCTAssertTrue(stubDisplayLinkFactory.displayLink.running);
328312
FVPTextureBasedVideoPlayer *player =
329313
(FVPTextureBasedVideoPlayer *)videoPlayerPlugin.playersByIdentifier[playerIdentifier];
330314
// Wait for the player's position to update, it shouldn't take long.
@@ -347,20 +331,15 @@ - (void)testSeekToWhilePausedStartsDisplayLinkTemporarily {
347331
stubDisplayLinkFactory.fireDisplayLink();
348332
CFRelease([player copyPixelBuffer]);
349333
// Since a frame was found, and the video is paused, the display link should be paused again.
350-
OCMVerify([mockDisplayLink setRunning:NO]);
334+
XCTAssertFalse(stubDisplayLinkFactory.displayLink.running);
351335
}
352336

353337
- (void)testInitStartsDisplayLinkTemporarily {
354338
NSObject<FlutterTextureRegistry> *mockTextureRegistry =
355339
OCMProtocolMock(@protocol(FlutterTextureRegistry));
356340
NSObject<FlutterPluginRegistrar> *registrar = OCMProtocolMock(@protocol(FlutterPluginRegistrar));
357341
OCMStub([registrar textures]).andReturn(mockTextureRegistry);
358-
FVPDisplayLink *mockDisplayLink =
359-
OCMPartialMock([[FVPDisplayLink alloc] initWithRegistrar:registrar
360-
callback:^(){
361-
}]);
362-
StubFVPDisplayLinkFactory *stubDisplayLinkFactory =
363-
[[StubFVPDisplayLinkFactory alloc] initWithDisplayLink:mockDisplayLink];
342+
StubFVPDisplayLinkFactory *stubDisplayLinkFactory = [[StubFVPDisplayLinkFactory alloc] init];
364343
AVPlayerItemVideoOutput *mockVideoOutput = OCMPartialMock([[AVPlayerItemVideoOutput alloc] init]);
365344
StubAVPlayer *stubAVPlayer = [[StubAVPlayer alloc] init];
366345
FVPVideoPlayerPlugin *videoPlayerPlugin = [[FVPVideoPlayerPlugin alloc]
@@ -384,7 +363,7 @@ - (void)testInitStartsDisplayLinkTemporarily {
384363
NSNumber *playerIdentifier = [videoPlayerPlugin createWithOptions:create error:&createError];
385364

386365
// Init should start the display link temporarily.
387-
OCMVerify([mockDisplayLink setRunning:YES]);
366+
XCTAssertTrue(stubDisplayLinkFactory.displayLink.running);
388367

389368
// Simulate a buffer being available.
390369
OCMStub([mockVideoOutput hasNewPixelBufferForItemTime:kCMTimeZero])
@@ -401,20 +380,15 @@ - (void)testInitStartsDisplayLinkTemporarily {
401380
stubDisplayLinkFactory.fireDisplayLink();
402381
CFRelease([player copyPixelBuffer]);
403382
// Since a frame was found, and the video is paused, the display link should be paused again.
404-
OCMVerify([mockDisplayLink setRunning:NO]);
383+
XCTAssertFalse(stubDisplayLinkFactory.displayLink.running);
405384
}
406385

407386
- (void)testSeekToWhilePlayingDoesNotStopDisplayLink {
408387
NSObject<FlutterTextureRegistry> *mockTextureRegistry =
409388
OCMProtocolMock(@protocol(FlutterTextureRegistry));
410389
NSObject<FlutterPluginRegistrar> *registrar = OCMProtocolMock(@protocol(FlutterPluginRegistrar));
411390
OCMStub([registrar textures]).andReturn(mockTextureRegistry);
412-
FVPDisplayLink *mockDisplayLink =
413-
OCMPartialMock([[FVPDisplayLink alloc] initWithRegistrar:registrar
414-
callback:^(){
415-
}]);
416-
StubFVPDisplayLinkFactory *stubDisplayLinkFactory =
417-
[[StubFVPDisplayLinkFactory alloc] initWithDisplayLink:mockDisplayLink];
391+
StubFVPDisplayLinkFactory *stubDisplayLinkFactory = [[StubFVPDisplayLinkFactory alloc] init];
418392
AVPlayerItemVideoOutput *mockVideoOutput = OCMPartialMock([[AVPlayerItemVideoOutput alloc] init]);
419393
FVPVideoPlayerPlugin *videoPlayerPlugin = [[FVPVideoPlayerPlugin alloc]
420394
initWithAVFactory:[[StubFVPAVFactory alloc] initWithPlayer:nil output:mockVideoOutput]
@@ -446,7 +420,7 @@ - (void)testSeekToWhilePlayingDoesNotStopDisplayLink {
446420
[initializedExpectation fulfill];
447421
}];
448422
[self waitForExpectationsWithTimeout:30.0 handler:nil];
449-
OCMVerify([mockDisplayLink setRunning:YES]);
423+
XCTAssertTrue(stubDisplayLinkFactory.displayLink.running);
450424

451425
FVPTextureBasedVideoPlayer *player =
452426
(FVPTextureBasedVideoPlayer *)videoPlayerPlugin.playersByIdentifier[playerIdentifier];
@@ -470,20 +444,15 @@ - (void)testSeekToWhilePlayingDoesNotStopDisplayLink {
470444
stubDisplayLinkFactory.fireDisplayLink();
471445
CFRelease([player copyPixelBuffer]);
472446
// Since the video was playing, the display link should not be paused after getting a buffer.
473-
OCMVerify(never(), [mockDisplayLink setRunning:NO]);
447+
XCTAssertTrue(stubDisplayLinkFactory.displayLink.running);
474448
}
475449

476450
- (void)testPauseWhileWaitingForFrameDoesNotStopDisplayLink {
477451
NSObject<FlutterTextureRegistry> *mockTextureRegistry =
478452
OCMProtocolMock(@protocol(FlutterTextureRegistry));
479453
NSObject<FlutterPluginRegistrar> *registrar = OCMProtocolMock(@protocol(FlutterPluginRegistrar));
480454
OCMStub([registrar textures]).andReturn(mockTextureRegistry);
481-
FVPDisplayLink *mockDisplayLink =
482-
OCMPartialMock([[FVPDisplayLink alloc] initWithRegistrar:registrar
483-
callback:^(){
484-
}]);
485-
StubFVPDisplayLinkFactory *stubDisplayLinkFactory =
486-
[[StubFVPDisplayLinkFactory alloc] initWithDisplayLink:mockDisplayLink];
455+
StubFVPDisplayLinkFactory *stubDisplayLinkFactory = [[StubFVPDisplayLinkFactory alloc] init];
487456
AVPlayerItemVideoOutput *mockVideoOutput = OCMPartialMock([[AVPlayerItemVideoOutput alloc] init]);
488457
FVPVideoPlayerPlugin *videoPlayerPlugin = [[FVPVideoPlayerPlugin alloc]
489458
initWithAVFactory:[[StubFVPAVFactory alloc] initWithPlayer:nil output:mockVideoOutput]
@@ -510,7 +479,7 @@ - (void)testPauseWhileWaitingForFrameDoesNotStopDisplayLink {
510479
[videoPlayerPlugin pausePlayer:playerIdentifier.integerValue error:&playPauseError];
511480

512481
// Since a buffer hasn't been available yet, the pause should not have stopped the display link.
513-
OCMVerify(never(), [mockDisplayLink setRunning:NO]);
482+
XCTAssertTrue(stubDisplayLinkFactory.displayLink.running);
514483
}
515484

516485
- (void)testDeregistersFromPlayer {
@@ -1004,11 +973,7 @@ - (void)testPlayerShouldNotDropEverySecondFrame {
1004973
OCMProtocolMock(@protocol(FlutterTextureRegistry));
1005974
OCMStub([registrar textures]).andReturn(mockTextureRegistry);
1006975

1007-
FVPDisplayLink *displayLink = [[FVPDisplayLink alloc] initWithRegistrar:registrar
1008-
callback:^(){
1009-
}];
1010-
StubFVPDisplayLinkFactory *stubDisplayLinkFactory =
1011-
[[StubFVPDisplayLinkFactory alloc] initWithDisplayLink:displayLink];
976+
StubFVPDisplayLinkFactory *stubDisplayLinkFactory = [[StubFVPDisplayLinkFactory alloc] init];
1012977
AVPlayerItemVideoOutput *mockVideoOutput = OCMPartialMock([[AVPlayerItemVideoOutput alloc] init]);
1013978
FVPVideoPlayerPlugin *videoPlayerPlugin = [[FVPVideoPlayerPlugin alloc]
1014979
initWithAVFactory:[[StubFVPAVFactory alloc] initWithPlayer:nil output:mockVideoOutput]
Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
#import <Foundation/Foundation.h>
88
#import <QuartzCore/QuartzCore.h>
99

10-
/// A proxy object to act as a CADisplayLink target, to avoid retain loops, since FVPDisplayLink
10+
/// A proxy object to act as a CADisplayLink target, to avoid retain loops, since FVPCADisplayLink
1111
/// owns its CADisplayLink, but CADisplayLink retains its target.
12+
API_AVAILABLE(ios(4.0), macos(14.0))
1213
@interface FVPDisplayLinkTarget : NSObject
1314
@property(nonatomic) void (^callback)(void);
1415

@@ -35,20 +36,29 @@ - (void)onDisplayLink:(CADisplayLink *)link {
3536

3637
#pragma mark -
3738

38-
@interface FVPDisplayLink ()
39+
@interface FVPCADisplayLink ()
3940
// The underlying display link implementation.
4041
@property(nonatomic) CADisplayLink *displayLink;
4142
@property(nonatomic) FVPDisplayLinkTarget *target;
4243
@end
4344

44-
@implementation FVPDisplayLink
45+
@implementation FVPCADisplayLink
4546

4647
- (instancetype)initWithRegistrar:(id<FlutterPluginRegistrar>)registrar
4748
callback:(void (^)(void))callback {
4849
self = [super init];
4950
if (self) {
5051
_target = [[FVPDisplayLinkTarget alloc] initWithCallback:callback];
52+
#if TARGET_OS_IOS
5153
_displayLink = [CADisplayLink displayLinkWithTarget:_target selector:@selector(onDisplayLink:)];
54+
#else
55+
// Use the view if one is wired up, otherwise fall back to the main screen.
56+
// TODO(stuartmorgan): Consider an API to inform plugins about attached view changes.
57+
NSView *view = registrar.view;
58+
_displayLink = view ? [view displayLinkWithTarget:_target selector:@selector(onDisplayLink:)]
59+
: [NSScreen.mainScreen displayLinkWithTarget:_target
60+
selector:@selector(onDisplayLink:)];
61+
#endif
5262
[_displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
5363
_displayLink.paused = YES;
5464
}

packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation/FVPTextureBasedVideoPlayer.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ @interface FVPTextureBasedVideoPlayer ()
99
// The updater that drives callbacks to the engine to indicate that a new frame is ready.
1010
@property(nonatomic) FVPFrameUpdater *frameUpdater;
1111
// The display link that drives frameUpdater.
12-
@property(nonatomic) FVPDisplayLink *displayLink;
12+
@property(nonatomic) NSObject<FVPDisplayLink> *displayLink;
1313
// The latest buffer obtained from video output. This is stored so that it can be returned from
1414
// copyPixelBuffer again if nothing new is available, since the engine has undefined behavior when
1515
// returning NULL.
@@ -34,7 +34,7 @@ @interface FVPTextureBasedVideoPlayer ()
3434
@implementation FVPTextureBasedVideoPlayer
3535
- (instancetype)initWithAsset:(NSString *)asset
3636
frameUpdater:(FVPFrameUpdater *)frameUpdater
37-
displayLink:(FVPDisplayLink *)displayLink
37+
displayLink:(NSObject<FVPDisplayLink> *)displayLink
3838
avFactory:(id<FVPAVFactory>)avFactory
3939
viewProvider:(NSObject<FVPViewProvider> *)viewProvider
4040
onDisposed:(void (^)(int64_t))onDisposed {
@@ -49,7 +49,7 @@ - (instancetype)initWithAsset:(NSString *)asset
4949

5050
- (instancetype)initWithURL:(NSURL *)url
5151
frameUpdater:(FVPFrameUpdater *)frameUpdater
52-
displayLink:(FVPDisplayLink *)displayLink
52+
displayLink:(NSObject<FVPDisplayLink> *)displayLink
5353
httpHeaders:(nonnull NSDictionary<NSString *, NSString *> *)headers
5454
avFactory:(id<FVPAVFactory>)avFactory
5555
viewProvider:(NSObject<FVPViewProvider> *)viewProvider
@@ -70,7 +70,7 @@ - (instancetype)initWithURL:(NSURL *)url
7070

7171
- (instancetype)initWithPlayerItem:(AVPlayerItem *)item
7272
frameUpdater:(FVPFrameUpdater *)frameUpdater
73-
displayLink:(FVPDisplayLink *)displayLink
73+
displayLink:(NSObject<FVPDisplayLink> *)displayLink
7474
avFactory:(id<FVPAVFactory>)avFactory
7575
viewProvider:(NSObject<FVPViewProvider> *)viewProvider
7676
onDisposed:(void (^)(int64_t))onDisposed {

packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation/FVPVideoPlayerPlugin.m

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,16 @@ @interface FVPDefaultDisplayLinkFactory : NSObject <FVPDisplayLinkFactory>
3030
@end
3131

3232
@implementation FVPDefaultDisplayLinkFactory
33-
- (FVPDisplayLink *)displayLinkWithRegistrar:(id<FlutterPluginRegistrar>)registrar
34-
callback:(void (^)(void))callback {
35-
return [[FVPDisplayLink alloc] initWithRegistrar:registrar callback:callback];
33+
- (NSObject<FVPDisplayLink> *)displayLinkWithRegistrar:(id<FlutterPluginRegistrar>)registrar
34+
callback:(void (^)(void))callback {
35+
#if TARGET_OS_IOS
36+
return [[FVPCADisplayLink alloc] initWithRegistrar:registrar callback:callback];
37+
#else
38+
if (@available(macOS 14.0, *)) {
39+
return [[FVPCADisplayLink alloc] initWithRegistrar:registrar callback:callback];
40+
}
41+
return [[FVPCoreVideoDisplayLink alloc] initWithRegistrar:registrar callback:callback];
42+
#endif
3643
}
3744

3845
@end
@@ -198,7 +205,7 @@ - (nullable NSNumber *)createWithOptions:(nonnull FVPCreationOptions *)options
198205
- (nullable FVPTextureBasedVideoPlayer *)texturePlayerWithOptions:
199206
(nonnull FVPCreationOptions *)options {
200207
FVPFrameUpdater *frameUpdater = [[FVPFrameUpdater alloc] initWithRegistry:_registry];
201-
FVPDisplayLink *displayLink =
208+
NSObject<FVPDisplayLink> *displayLink =
202209
[self.displayLinkFactory displayLinkWithRegistrar:_registrar
203210
callback:^() {
204211
[frameUpdater displayLinkFired];

packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation/include/video_player_avfoundation/FVPDisplayLink.h

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#endif
1212

1313
// A cross-platform display link abstraction.
14-
@interface FVPDisplayLink : NSObject
14+
@protocol FVPDisplayLink <NSObject>
1515

1616
/// Whether the display link is currently running (i.e., firing events).
1717
///
@@ -21,6 +21,12 @@
2121
/// The time interval between screen refresh updates.
2222
@property(nonatomic, readonly) CFTimeInterval duration;
2323

24+
@end
25+
26+
// An implementation of FVPDisplayLink using CADisplayLink.
27+
API_AVAILABLE(ios(4.0), macos(14.0))
28+
@interface FVPCADisplayLink : NSObject <FVPDisplayLink>
29+
2430
/// Initializes a display link that calls the given callback when fired.
2531
///
2632
/// The display link starts paused, so must be started, by setting 'running' to YES, before the
@@ -31,3 +37,19 @@
3137
- (instancetype)init NS_UNAVAILABLE;
3238

3339
@end
40+
41+
#if TARGET_OS_OSX
42+
// An implementation of FVPDisplayLink using CVDisplayLink.
43+
@interface FVPCoreVideoDisplayLink : NSObject <FVPDisplayLink>
44+
45+
/// Initializes a display link that calls the given callback when fired.
46+
///
47+
/// The display link starts paused, so must be started, by setting 'running' to YES, before the
48+
/// callback will fire.
49+
- (instancetype)initWithRegistrar:(id<FlutterPluginRegistrar>)registrar
50+
callback:(void (^)(void))callback NS_DESIGNATED_INITIALIZER;
51+
52+
- (instancetype)init NS_UNAVAILABLE;
53+
54+
@end
55+
#endif

packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation/include/video_player_avfoundation/FVPFrameUpdater.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
2020
/// The Flutter texture registry used to notify about new frames.
2121
@property(nonatomic, weak, readonly) NSObject<FlutterTextureRegistry> *registry;
2222
/// The display link that drives frameUpdater.
23-
@property(nonatomic) FVPDisplayLink *displayLink;
23+
@property(nonatomic) NSObject<FVPDisplayLink> *displayLink;
2424
/// The time interval between screen refresh updates. Display link duration is in an undefined state
2525
/// until displayLinkFired is called at least once so it should not be used directly.
2626
@property(atomic) CFTimeInterval frameDuration;

packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation/include/video_player_avfoundation/FVPTextureBasedVideoPlayer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
1818
/// display link, HTTP headers, AV factory, and registrar.
1919
- (instancetype)initWithURL:(NSURL *)url
2020
frameUpdater:(FVPFrameUpdater *)frameUpdater
21-
displayLink:(FVPDisplayLink *)displayLink
21+
displayLink:(NSObject<FVPDisplayLink> *)displayLink
2222
httpHeaders:(nonnull NSDictionary<NSString *, NSString *> *)headers
2323
avFactory:(id<FVPAVFactory>)avFactory
2424
viewProvider:(NSObject<FVPViewProvider> *)viewProvider
@@ -28,7 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
2828
/// display link, AV factory, and registrar.
2929
- (instancetype)initWithAsset:(NSString *)asset
3030
frameUpdater:(FVPFrameUpdater *)frameUpdater
31-
displayLink:(FVPDisplayLink *)displayLink
31+
displayLink:(NSObject<FVPDisplayLink> *)displayLink
3232
avFactory:(id<FVPAVFactory>)avFactory
3333
viewProvider:(NSObject<FVPViewProvider> *)viewProvider
3434
onDisposed:(void (^)(int64_t))onDisposed;

0 commit comments

Comments
 (0)