zoukankan      html  css  js  c++  java
  • GPU 踩的几个坑

    GPUimage
    前几帧是黑色的;
    背景色是蓝色的;
    静音录制崩溃;
    push 的时间延迟;

    前几帧是黑色的,
    https://github.com/BradLarson/GPUImage/issues/1255
    static BOOL allowWriteAudio = NO;
    
    - (void)startRecording;
    {
      ...
      allowWriteAudio = NO;
    }
    
    - (void)processAudioBuffer:(CMSampleBufferRef)audioBuffer;
    {
      if (!allowWriteAudio) {
        return;
      }
      ...
    }
    
    - (void)newFrameReadyAtTime:(CMTime)frameTime atIndex:(NSInteger)textureIndex;
    {
      ...
      if (![assetWriterPixelBufferInput appendPixelBuffer:pixel_buffer withPresentationTime:frameTime])
        NSLog(@"Problem appending pixel buffer at time: %@", CFBridgingRelease(CMTimeCopyDescription(kCFAllocatorDefault, frameTime)));
    
      allowWriteAudio = YES;   //< add this
      ...
    }
    
    push 的时间延迟bug
                //只有一段视频
                [KJUtility hideProgressDialog];
                NSDictionary *dict = self.kj_videoArray.firstObject;
                self.kj_outPath = dict[@"path"];
    
    
    
                [self saveVideoToLibrary];
                WS(weakSelf)
                if (self.kjFileDelegate && [self.kjFileDelegate respondsToSelector:@selector(kj_videoFileCompleteLocalPath:)]) {
                    NSLog(@"一段视频:.........%@",self.kj_outPath);
                    [self.kjFileDelegate kj_videoFileCompleteLocalPath:self.kj_outPath];
                } else {
                    [self saveVideoToLibrary];
                }
    
    
    蓝边的bug
    //        kj_movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:videoURL size:CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT)];
    
            kj_movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:videoURL size:CGSizeMake(floor(1080), floor(1920))];
    

    https://github.com/BradLarson/GPUImage/issues/1276

    静音的bug
    AVURLAsset *kj_videoAsset = [[AVURLAsset alloc] initWithURL:tmpUrl options:kj_options];
            if ([[kj_videoAsset tracksWithMediaType:AVMediaTypeAudio] count] > 0){
                kj_movieComposition.audioEncodingTarget = kj_movieWriter;
            } else {//no audio
                kj_movieComposition.audioEncodingTarget = nil;
            }
    //        kj_movieComposition.audioEncodingTarget = kj_movieWriter;
    
     if ([[anAsset tracksWithMediaType:AVMediaTypeAudio] count] > 0){
                _movieFile.audioEncodingTarget = _movieWriter;
            } else {//no audio
                _movieFile.audioEncodingTarget = nil;
            }
    
  • 相关阅读:
    那些ubuntu创建用户踩过的坑
    Build tools
    version control(以git为例)讲解
    URI和URL的区别
    HTTP解析过程心得
    函数式编程(functional programming)
    cb45a_c++_STL_算法_删除_(3)_unique(唯一的意思)删除连续性的重复的数据
    cb44a_c++_STL_算法_删除_(2)remove_copy_remove_copy_if
    cb43a_c++_STL_算法_删除_(1)remove_remove_if
    cb42a_c++_STL_算法_替换_replace
  • 原文地址:https://www.cnblogs.com/guligei/p/9834881.html
Copyright © 2011-2022 走看看