1616__weak static TIoTAVCaptionFLV *tAVCaptionFLV = nil ;
1717static flv_muxer_t * flvMuxer = nullptr ;
1818dispatch_queue_t muxerQueue;
19- NSFileHandle *_fileHandle;
19+ // NSFileHandle *_fileHandle;
2020
2121@interface TIoTAVCaptionFLV ()<AVCaptureVideoDataOutputSampleBufferDelegate,AVCaptureAudioDataOutputSampleBufferDelegate,H264EncoderDelegate>
2222// 负责输如何输出设备之间的数据传递
@@ -216,8 +216,8 @@ - (void)gotEncodedData:(NSData*)data isKeyFrame:(BOOL)isKeyFrame {
216216
217217// NSLog(@"Video data (%lu):%@", (unsigned long)data.length,data.description);
218218
219- if (_fileHandle != NULL )
220- {
219+ // if (_fileHandle != NULL)
220+ // {
221221 const char bytes[] = " \x00\x00\x00\x01 " ;
222222 size_t length = (sizeof bytes) - 1 ; // string literals have implicit trailing '\0'
223223 NSData *ByteHeader = [NSData dataWithBytes: bytes length: length];
@@ -229,7 +229,7 @@ - (void)gotEncodedData:(NSData*)data isKeyFrame:(BOOL)isKeyFrame {
229229 NSMutableData *fullH264 = [NSMutableData dataWithData: ByteHeader];
230230 [fullH264 appendData: data];
231231 encodeFlvData (1 , fullH264);
232- }
232+ // }
233233
234234}
235235
@@ -258,8 +258,8 @@ static int flv_onwrite(void *param, const struct flv_vec_t* vec, int n) {
258258 offset += vec[i].len ;
259259 }
260260
261- NSData *ByteHeader = [NSData dataWithBytes: bytes length: total_size];
262- [_fileHandle writeData: ByteHeader];
261+ // NSData *ByteHeader = [NSData dataWithBytes:bytes length:total_size];
262+ // [_fileHandle writeData:ByteHeader];
263263
264264 [tAVCaptionFLV.delegate capture: (uint8_t *)bytes len: total_size];
265265
@@ -313,10 +313,10 @@ -(BOOL) startCapture {
313313 NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES );
314314 NSString *documentsDirectory = [paths firstObject ];
315315
316- self.h264File = [documentsDirectory stringByAppendingPathComponent: @" lyh.h264.flv" ];
317- [fileManager removeItemAtPath: self .h264File error: nil ];
318- [fileManager createFileAtPath: self .h264File contents: nil attributes: nil ];
319- _fileHandle = [NSFileHandle fileHandleForWritingAtPath: self .h264File];
316+ // self.h264File = [documentsDirectory stringByAppendingPathComponent:@"lyh.h264.flv"];
317+ // [fileManager removeItemAtPath:self.h264File error:nil];
318+ // [fileManager createFileAtPath:self.h264File contents:nil attributes:nil];
319+ // _fileHandle = [NSFileHandle fileHandleForWritingAtPath:self.h264File];
320320
321321 flv_init_load ();
322322
@@ -341,8 +341,8 @@ - (void) stopCarmera
341341// [_h264Encoder End];
342342 [_session stopRunning ];
343343
344- [_fileHandle closeFile ];
345- _fileHandle = NULL ;
344+ // [_fileHandle closeFile];
345+ // _fileHandle = NULL;
346346//
347347 // 获取程序Documents目录路径
348348 NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory,NSUserDomainMask, YES );
0 commit comments