久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

      <bdo id='KY2jK'></bdo><ul id='KY2jK'></ul>
      <tfoot id='KY2jK'></tfoot>
      <i id='KY2jK'><tr id='KY2jK'><dt id='KY2jK'><q id='KY2jK'><span id='KY2jK'><b id='KY2jK'><form id='KY2jK'><ins id='KY2jK'></ins><ul id='KY2jK'></ul><sub id='KY2jK'></sub></form><legend id='KY2jK'></legend><bdo id='KY2jK'><pre id='KY2jK'><center id='KY2jK'></center></pre></bdo></b><th id='KY2jK'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='KY2jK'><tfoot id='KY2jK'></tfoot><dl id='KY2jK'><fieldset id='KY2jK'></fieldset></dl></div>
    1. <small id='KY2jK'></small><noframes id='KY2jK'>

      <legend id='KY2jK'><style id='KY2jK'><dir id='KY2jK'><q id='KY2jK'></q></dir></style></legend>

      1. 從 AVAssetReaderOutput 讀取數據時,iOS 5.0 崩潰

        iOS 5.0 crash when reading data from an AVAssetReaderOutput(從 AVAssetReaderOutput 讀取數據時,iOS 5.0 崩潰)
          <tbody id='NiiCp'></tbody>

          1. <small id='NiiCp'></small><noframes id='NiiCp'>

            <tfoot id='NiiCp'></tfoot>
              <legend id='NiiCp'><style id='NiiCp'><dir id='NiiCp'><q id='NiiCp'></q></dir></style></legend>
              • <bdo id='NiiCp'></bdo><ul id='NiiCp'></ul>
                <i id='NiiCp'><tr id='NiiCp'><dt id='NiiCp'><q id='NiiCp'><span id='NiiCp'><b id='NiiCp'><form id='NiiCp'><ins id='NiiCp'></ins><ul id='NiiCp'></ul><sub id='NiiCp'></sub></form><legend id='NiiCp'></legend><bdo id='NiiCp'><pre id='NiiCp'><center id='NiiCp'></center></pre></bdo></b><th id='NiiCp'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='NiiCp'><tfoot id='NiiCp'></tfoot><dl id='NiiCp'><fieldset id='NiiCp'></fieldset></dl></div>
                • 本文介紹了從 AVAssetReaderOutput 讀取數據時,iOS 5.0 崩潰的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我有這段用于從 AVAssetReaderOutput 讀取數據的代碼片段,該方法在 iOS 4.0 中運行良好,但在 5.0 中它會因訪問錯誤而崩潰,不知道為什么,任何人都有有什么意見嗎?

                  I have this snippet of code used to read data from an AVAssetReaderOutput, the method works fine in iOS 4.0, however in 5.0 it crashes towards the end with bad access, not sure why, anyone have any input?

                  AVAssetReaderOutput *output=[myOutputs objectAtIndex:0];
                   int totalBuff=0;
                  while(TRUE)
                  {
                       CMSampleBufferRef ref=[output copyNextSampleBuffer];
                      if(ref==NULL)
                          break;
                      //copy data to file
                      //read next one
                      AudioBufferList audioBufferList;
                      NSMutableData *data=[[NSMutableData alloc] init];
                      CMBlockBufferRef blockBuffer;
                      CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer(ref, NULL, &audioBufferList, sizeof(audioBufferList), NULL, NULL, 0, &blockBuffer);
                  
                  for( int y=0; y<audioBufferList.mNumberBuffers; y++ )
                  {
                      AudioBuffer audioBuffer = audioBufferList.mBuffers[y];
                      Float32 *frame = audioBuffer.mData;
                  
                  
                      NSLog(@"Gonna write %d", audioBuffer.mDataByteSize);
                      //crashes here
                      [data appendBytes:frame length:audioBuffer.mDataByteSize];
                  
                  
                  
                  }
                  
                  totalBuff++;
                  CFRelease(blockBuffer);
                  CFRelease(ref);
                  
                  
                     [fileHandle writeData:data];
                      [data release];
                  }
                  

                  謝謝

                  丹尼爾

                  推薦答案

                  我實際上是通過檢查 blockBuffer 是否為 null 來解決這個問題,如果是則繼續,問題是 ref 不是 null 但 blockBuffer 是所以這段代碼修復了我的問題

                  I actually fixed this by checking that blockBuffer was null and continuing if it was, the problem was that ref was not null but the blockBuffer was so this code fixed my issue

                  -(void)doExportSong:(NSURL*)url toFileUrl:(NSString*)fileURL 
                  {
                      AVURLAsset *asset=[[[AVURLAsset alloc] initWithURL:url options:nil] autorelease];
                      AVAssetReader *reader=[[[AVAssetReader alloc] initWithAsset:asset error:nil] autorelease];
                      [reader setTimeRange:CMTimeRangeMake(kCMTimeZero, kCMTimePositiveInfinity)];
                      NSMutableArray *myOutputs =[[NSMutableArray alloc] init];
                      for(id track in [asset tracks])
                      {
                          AVAssetReaderTrackOutput *ot=[AVAssetReaderTrackOutput assetReaderTrackOutputWithTrack:track outputSettings:nil];
                  
                          [myOutputs addObject:ot]; 
                          [reader addOutput:ot];
                      }
                      [reader startReading];
                      NSFileHandle *fileHandle ;
                      NSFileManager *fm=[NSFileManager defaultManager];
                      if(![fm fileExistsAtPath:fileURL])
                      {
                          [fm createFileAtPath:fileURL contents:[[[NSData alloc] init] autorelease] attributes:nil];
                      }
                      fileHandle=[NSFileHandle fileHandleForUpdatingAtPath:fileURL];    
                      [fileHandle seekToEndOfFile];
                  
                      AVAssetReaderOutput *output=[myOutputs objectAtIndex:0];
                  
                      int totalBuff=0;
                      BOOL one=TRUE;
                      while(TRUE)
                      {
                          CMSampleBufferRef ref=[output copyNextSampleBuffer];
                          // NSLog(@"%@",ref);
                          if(ref==NULL)
                              break;
                          //copy data to file
                          //read next one
                          AudioBufferList audioBufferList;
                          NSMutableData *data=[[NSMutableData alloc] init];
                          CMBlockBufferRef blockBuffer;
                          CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer(ref, NULL, &audioBufferList, sizeof(audioBufferList), NULL, NULL, 0, &blockBuffer);
                          // NSLog(@"%@",blockBuffer);
                  
                          if(blockBuffer==NULL)
                          {
                  
                                  [data release];
                                  continue;
                  
                          }
                          if(&audioBufferList==NULL)
                          {
                              [data release];
                              continue;
                          }
                  
                          for( int y=0; y<audioBufferList.mNumberBuffers; y++ )
                          {
                              AudioBuffer audioBuffer = audioBufferList.mBuffers[y];
                              Float32 *frame = (Float32*)audioBuffer.mData;
                  
                  
                              [data appendBytes:frame length:audioBuffer.mDataByteSize];
                  
                  
                  
                          }
                  
                          totalBuff++;
                  
                          CFRelease(blockBuffer);
                          CFRelease(ref);
                          ref=NULL;
                          blockBuffer=NULL;
                          [fileHandle writeData:data];
                          [data release];
                      }
                  
                      [fileHandle closeFile];
                      [myOutputs release];  
                  }
                  

                  這篇關于從 AVAssetReaderOutput 讀取數據時,iOS 5.0 崩潰的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to animate a UIImageview to display fullscreen by tapping on it?(如何通過點擊動畫 UIImageview 以顯示全屏?)
                  To stop segue and show alert(停止 segue 并顯示警報)
                  iOS 5 storyboard, programmatically determine path(iOS 5 故事板,以編程方式確定路徑)
                  Icon already includes gloss effects(圖標已經包含光澤效果)
                  How does UIEdgeInsetsMake work?(UIEdgeInsetsMake 是如何工作的?)
                  UIProgressView and Custom Track and Progress Images (iOS 5 properties)(UIProgressView 和自定義跟蹤和進度圖像(iOS 5 屬性))
                      • <bdo id='iH8K1'></bdo><ul id='iH8K1'></ul>

                          <tbody id='iH8K1'></tbody>

                          <small id='iH8K1'></small><noframes id='iH8K1'>

                          <tfoot id='iH8K1'></tfoot>
                        • <i id='iH8K1'><tr id='iH8K1'><dt id='iH8K1'><q id='iH8K1'><span id='iH8K1'><b id='iH8K1'><form id='iH8K1'><ins id='iH8K1'></ins><ul id='iH8K1'></ul><sub id='iH8K1'></sub></form><legend id='iH8K1'></legend><bdo id='iH8K1'><pre id='iH8K1'><center id='iH8K1'></center></pre></bdo></b><th id='iH8K1'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='iH8K1'><tfoot id='iH8K1'></tfoot><dl id='iH8K1'><fieldset id='iH8K1'></fieldset></dl></div>
                        • <legend id='iH8K1'><style id='iH8K1'><dir id='iH8K1'><q id='iH8K1'></q></dir></style></legend>
                            主站蜘蛛池模板: 日本久久久久久 | 一区二区三区四区免费视频 | 色综合桃花网 | 久久久久国产一区二区三区 | 国产精品不卡 | 午夜噜噜噜 | 最新一级毛片 | 亚洲欧美国产精品久久 | 亚洲综合色丁香婷婷六月图片 | 中国黄色毛片视频 | 久久aⅴ乱码一区二区三区 亚洲国产成人精品久久久国产成人一区 | 亚洲一区二区三区在线播放 | 色爱综合 | 国产www.| 中文字幕av高清 | 91九色在线观看 | 欧美激情国产日韩精品一区18 | 国产yw851.c免费观看网站 | 免费午夜剧场 | 欧美激情亚洲激情 | 国产农村一级国产农村 | 精品欧美一区二区三区久久久小说 | 一区二区三区在线免费看 | 欧美成人免费在线视频 | 欧美精品一区二区三区蜜桃视频 | 亚洲一区二区黄 | 亚洲成人中文字幕 | 二区久久 | 午夜资源 | 中文字幕在线第二页 | 欧美aaaaaaaaaa | 中文字幕 国产精品 | 国产高清无av久久 | 午夜国产羞羞视频免费网站 | 一级二级三级黄色 | 精品综合久久久 | 亚洲精品一区二区 | 国产精品久久久亚洲 | 成人欧美一区二区三区在线播放 | 精品一区二区三区在线视频 | 亚洲色图综合网 |