title: Putting an H.264 I frame to AVSampleBufferDisplayLayer but no video image is displayed
body: <p>After having a detail review of WWDC2014,Session513, I try to write my app on IOS8.0 to decode and display one live H.264 stream. First of all, I construct a H264 parameter set successfully. When I get one I frame with a 4 bit start code,just like"0x00 0x00 0x00 0x01 0x65 ...", I put  it into a CMblockBuffer. Then I construct a CMSampleBuffer using previews CMBlockBuffer. After that,I put the CMSampleBuffer into a AVSampleBufferDisplayLayer. Everything is OK(I checked the value returned ) except the AVSampleBufferDisplayLayer does not show any video image. Since these APIs are fairly new to everyone, I couldn't find any body who can resolve this problem.</p>
  
  <p>I'll give the key codes as follows,and I do really appreciate it if you can help to figure out why the vide image can't be displayed. Thanks a lot.</p>
  
  <p>(1) AVSampleBufferDisplayLayer initialised. 
  dsplayer  is a objc instance of my main view controller.</p>
  
  <pre><code>    @property(nonatomic,strong)AVSampleBufferDisplayLayer *dspLayer;
  
  if(!_dspLayer)
  {
      _dspLayer = [[AVSampleBufferDisplayLayer alloc]init];
      [_dspLayer setFrame:CGRectMake(90,551,557,389)];
      _dspLayer.videoGravity = AVLayerVideoGravityResizeAspect;
     _dspLayer.backgroundColor = [UIColor grayColor].CGColor;
      CMTimebaseRef tmBase = nil;
      CMTimebaseCreateWithMasterClock(NULL,CMClockGetHostTimeClock(),&amp;tmBase);
      _dspLayer.controlTimebase = tmBase;
      CMTimebaseSetTime(_dspLayer.controlTimebase, kCMTimeZero);
      CMTimebaseSetRate(_dspLayer.controlTimebase, 1.0);
  
       [self.view.layer addSublayer:_dspLayer];
  
  }
  </code></pre>
  
  <p>(2)In another thread, I get one H.264 I frame.
          //construct h.264 parameter set ok</p>
  
  <pre><code>    CMVideoFormatDescriptionRef formatDesc;
      OSStatus formatCreateResult =
      CMVideoFormatDescriptionCreateFromH264ParameterSets(NULL, ppsNum+1, props, sizes, 4, &amp;formatDesc);
      NSLog([NSString stringWithFormat:@"construct h264 param set:%ld",formatCreateResult]);
  </code></pre>
  
  <p>//construct cmBlockbuffer .
  //databuf points to H.264 data. starts with "0x00 0x00 0x00 0x01 0x65 ........"      </p>
  
  <pre><code>    CMBlockBufferRef blockBufferOut = nil;
      CMBlockBufferCreateEmpty (0,0,kCMBlockBufferAlwaysCopyDataFlag, &amp;blockBufferOut);
      CMBlockBufferAppendMemoryBlock(blockBufferOut,
                                      dataBuf,
                                      dataLen,
                                      NULL,
                                      NULL,
                                      0,
                                      dataLen,
                                      kCMBlockBufferAlwaysCopyDataFlag);
  </code></pre>
  
  <p>//construct cmsamplebuffer ok</p>
  
  <pre><code>    size_t sampleSizeArray[1] = {0};
      sampleSizeArray[0] = CMBlockBufferGetDataLength(blockBufferOut);
      CMSampleTiminginfo tmInfos[1] = {
          {CMTimeMake(5,1), CMTimeMake(5,1), CMTimeMake(5,1)}
      };
      CMSampleBufferRef sampBuf = nil;
      formatCreateResult = CMSampleBufferCreate(kCFAllocatorDefault,
                           blockBufferOut,
                           YES,
                           NULL,
                           NULL,
                           formatDesc,
                           1,
                           1,
                           tmInfos,
                           1,
                           sampleSizeArray,
                           &amp;sampBuf);
  </code></pre>
  
  <p>//put to AVSampleBufferdisplayLayer,just one frame. But I can't see any video frame in my view</p>
  
  <pre><code>    if([self.dspLayer isReadyForMoreMediaData])
      {
      [self.dspLayer enqueueSampleBuffer:sampBuf];
      }
      [self.dspLayer setNeedsDisplay];
  </code></pre>