File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 4
4
// See: https://developer.apple.com/videos/play/wwdc2017/606/
5
5
6
6
@implementation FlutterRPScreenRecorder {
7
- RPScreenRecorder * screenRecorder;
7
+ RPScreenRecorder *screenRecorder;
8
+ RTCVideoSource *source;
8
9
}
9
10
10
11
- (instancetype )initWithDelegate : (__weak id <RTCVideoCapturerDelegate>)delegate {
12
+ source = delegate;
11
13
return [super initWithDelegate: delegate];
12
14
}
13
15
@@ -53,6 +55,11 @@ -(void)handleSourceBuffer:(CMSampleBufferRef)sampleBuffer sampleType:(RPSampleBu
53
55
return ;
54
56
}
55
57
58
+ size_t width = CVPixelBufferGetWidth (pixelBuffer);
59
+ size_t height = CVPixelBufferGetHeight (pixelBuffer);
60
+
61
+ [source adaptOutputFormatToWidth: width/2 height: height/2 fps: 8 ];
62
+
56
63
RTCCVPixelBuffer *rtcPixelBuffer = [[RTCCVPixelBuffer alloc ] initWithPixelBuffer: pixelBuffer];
57
64
int64_t timeStampNs =
58
65
CMTimeGetSeconds (CMSampleBufferGetPresentationTimeStamp (sampleBuffer)) * NSEC_PER_SEC;
Original file line number Diff line number Diff line change @@ -404,8 +404,6 @@ -(void)getDisplayMedia:(NSDictionary *)constraints
404
404
RTCVideoSource *videoSource = [self .peerConnectionFactory videoSource ];
405
405
FlutterRPScreenRecorder *screenCapturer = [[FlutterRPScreenRecorder alloc ] initWithDelegate: videoSource];
406
406
407
- [videoSource adaptOutputFormatToWidth: (NSUInteger )[UIScreen mainScreen ].bounds.size.width height: (NSUInteger )[UIScreen mainScreen ].bounds.size.height fps: self ._targetFps];
408
-
409
407
[screenCapturer startCapture ];
410
408
411
409
// TODO:
You can’t perform that action at this time.
0 commit comments