@@ -55,7 +55,7 @@ private class FakeMediaSettingsAVWrapper: FLTCamMediaSettingsAVWrapper {
55
55
}
56
56
57
57
override func recommendedVideoSettingsForAssetWriter(
58
- withFileType fileType: AVFileType , for output: AVCaptureVideoDataOutput
58
+ withFileType fileType: AVFileType , for output: FLTCaptureVideoDataOutput
59
59
) -> [ String : Any ] ? {
60
60
return [ : ]
61
61
}
@@ -100,7 +100,7 @@ final class CameraSampleBufferTests: XCTestCase {
100
100
let captureSessionQueue = DispatchQueue ( label: " testing " )
101
101
let camera = FLTCreateCamWithCaptureSessionQueue ( captureSessionQueue)
102
102
XCTAssertEqual (
103
- captureSessionQueue, camera. captureVideoOutput. sampleBufferCallbackQueue,
103
+ captureSessionQueue, camera. captureVideoOutput. avOutput . sampleBufferCallbackQueue,
104
104
" Sample buffer callback queue must be the capture session queue. " )
105
105
}
106
106
@@ -110,7 +110,8 @@ final class CameraSampleBufferTests: XCTestCase {
110
110
let capturedPixelBuffer = CMSampleBufferGetImageBuffer ( capturedSampleBuffer) !
111
111
// Mimic sample buffer callback when captured a new video sample.
112
112
camera. captureOutput (
113
- camera. captureVideoOutput, didOutputSampleBuffer: capturedSampleBuffer, from: connectionMock)
113
+ camera. captureVideoOutput. avOutput, didOutputSampleBuffer: capturedSampleBuffer,
114
+ from: connectionMock)
114
115
let deliveredPixelBuffer = camera. copyPixelBuffer ( ) ? . takeRetainedValue ( )
115
116
XCTAssertEqual (
116
117
deliveredPixelBuffer, capturedPixelBuffer,
@@ -129,7 +130,7 @@ final class CameraSampleBufferTests: XCTestCase {
129
130
camera. resumeVideoRecording ( )
130
131
131
132
camera. captureOutput (
132
- camera. captureVideoOutput, didOutputSampleBuffer: sampleBuffer, from: connectionMock)
133
+ camera. captureVideoOutput. avOutput , didOutputSampleBuffer: sampleBuffer, from: connectionMock)
133
134
134
135
let finalRetainCount = CFGetRetainCount ( sampleBuffer)
135
136
XCTAssertEqual (
@@ -166,7 +167,7 @@ final class CameraSampleBufferTests: XCTestCase {
166
167
camera. captureOutput ( nil , didOutputSampleBuffer: audioSample, from: connectionMock)
167
168
camera. captureOutput ( nil , didOutputSampleBuffer: audioSample, from: connectionMock)
168
169
camera. captureOutput (
169
- camera. captureVideoOutput, didOutputSampleBuffer: videoSample, from: connectionMock)
170
+ camera. captureVideoOutput. avOutput , didOutputSampleBuffer: videoSample, from: connectionMock)
170
171
camera. captureOutput ( nil , didOutputSampleBuffer: audioSample, from: connectionMock)
171
172
172
173
let expectedSamples = [ " video " , " audio " ]
@@ -207,17 +208,17 @@ final class CameraSampleBufferTests: XCTestCase {
207
208
camera. pauseVideoRecording ( )
208
209
camera. resumeVideoRecording ( )
209
210
camera. captureOutput (
210
- camera. captureVideoOutput, didOutputSampleBuffer: videoSample, from: connectionMock)
211
+ camera. captureVideoOutput. avOutput , didOutputSampleBuffer: videoSample, from: connectionMock)
211
212
camera. captureOutput ( nil , didOutputSampleBuffer: audioSample, from: connectionMock)
212
213
camera. captureOutput (
213
- camera. captureVideoOutput, didOutputSampleBuffer: videoSample, from: connectionMock)
214
+ camera. captureVideoOutput. avOutput , didOutputSampleBuffer: videoSample, from: connectionMock)
214
215
camera. captureOutput ( nil , didOutputSampleBuffer: audioSample, from: connectionMock)
215
216
216
217
XCTAssert ( videoAppended && audioAppended, " Video or audio was not appended. " )
217
218
}
218
219
219
220
func testDidOutputSampleBufferMustNotAppendSampleWhenReadyForMoreMediaDataIsFalse( ) {
220
- let ( camera, writerMock , adaptorMock, inputMock, connectionMock) = createCamera ( )
221
+ let ( camera, _ , adaptorMock, inputMock, connectionMock) = createCamera ( )
221
222
222
223
let videoSample = FLTCreateTestSampleBuffer ( ) . takeRetainedValue ( )
223
224
@@ -232,18 +233,18 @@ final class CameraSampleBufferTests: XCTestCase {
232
233
inputMock. readyForMoreMediaData = true
233
234
sampleAppended = false
234
235
camera. captureOutput (
235
- camera. captureVideoOutput, didOutputSampleBuffer: videoSample, from: connectionMock)
236
+ camera. captureVideoOutput. avOutput , didOutputSampleBuffer: videoSample, from: connectionMock)
236
237
XCTAssertTrue ( sampleAppended, " Sample was not appended. " )
237
238
238
239
inputMock. readyForMoreMediaData = false
239
240
sampleAppended = false
240
241
camera. captureOutput (
241
- camera. captureVideoOutput, didOutputSampleBuffer: videoSample, from: connectionMock)
242
+ camera. captureVideoOutput. avOutput , didOutputSampleBuffer: videoSample, from: connectionMock)
242
243
XCTAssertFalse ( sampleAppended, " Sample cannot be appended when readyForMoreMediaData is NO. " )
243
244
}
244
245
245
246
func testStopVideoRecordingWithCompletionMustCallCompletion( ) {
246
- let ( camera, writerMock, adaptorMock , inputMock , _) = createCamera ( )
247
+ let ( camera, writerMock, _ , _ , _) = createCamera ( )
247
248
248
249
var status = AVAssetWriter . Status. unknown
249
250
writerMock. startWritingStub = {
@@ -291,13 +292,13 @@ final class CameraSampleBufferTests: XCTestCase {
291
292
292
293
let startWritingCalledBefore = startWritingCalled
293
294
camera. captureOutput (
294
- camera. captureVideoOutput, didOutputSampleBuffer: videoSample, from: connectionMock)
295
+ camera. captureVideoOutput. avOutput , didOutputSampleBuffer: videoSample, from: connectionMock)
295
296
XCTAssert (
296
297
( startWritingCalledBefore && videoAppended) || ( startWritingCalled && !videoAppended) ,
297
298
" The startWriting was called between sample creation and appending. " )
298
299
299
300
camera. captureOutput (
300
- camera. captureVideoOutput, didOutputSampleBuffer: videoSample, from: connectionMock)
301
+ camera. captureVideoOutput. avOutput , didOutputSampleBuffer: videoSample, from: connectionMock)
301
302
XCTAssert ( videoAppended, " Video was not appended. " )
302
303
}
303
304
0 commit comments