title: Problem to Decode H264 video over RTP with ffmpeg (libavcodec)
body: <p>I set profile_idc, level_idc, extradata et extradata_size of AvCodecContext with the  profile-level-id et sprop-parameter-set of the SDP.</p>
  
  <p>I separate the decoding of Coded Slice, SPS, PPS and NAL_IDR_SLICE packet :</p>
  
  <h2>Init:</h2>
  
  <p>uint8_t start_sequence[]= {0, 0, 1};
  int size= recv(id_de_la_socket,(char*) rtpReceive,65535,0);</p>
  
  <h2>Coded Slice :</h2>
  
  <pre><code>char *z = new char[size-16+sizeof(start_sequence)];
      memcpy(z,&amp;start_sequence,sizeof(start_sequence));
      memcpy(z+sizeof(start_sequence),rtpReceive+16,size-16);
      ConsumedBytes = avcodec_decode_video(codecContext,pFrame,&amp;GotPicture,(uint8_t*)z,size-16+sizeof(start_sequence));
      delete z;
  </code></pre>
  
  <p>Result: ConsumedBytes >0 and GotPicture >0  (often)</p>
  
  <h2>SPS and PPS :</h2>
  
  <p>identical code.
  Result: ConsumedBytes >0 and GotPicture =0</p>
  
  <p>It's normal I think</p>
  
  <p>When I find a new couple SPS/PPS, I update extradata and extrada_size with the payloads of this packet and their size.</p>
  
  <h2>NAL_IDR_SLICE :</h2>
  
  <p>The Nal unit type is 28 =>idr Frame are fragmented therefor I tryed two method to decode</p>
  
  <p>1)  I prefix the first fragment (without RTP header) with the sequence 0x000001 and send it to avcodec_decode_video. Then I send the rest of fragments to this function.</p>
  
  <p>2) I prefix the first fragment (without RTP header) with the sequence 0x000001 and concatenate the rest of fragments to it. I send this buffer to decoder.</p>
  
  <p>In both cases, I have no error (ConsumedBytes >0) but I detect no frame (GotPicture = 0) ...</p>
  
  <p>What is the problem ?</p>