Skip to content

Commit

Permalink
packetizer: hevc: check before replacing xps
Browse files Browse the repository at this point in the history
  • Loading branch information
fcartegnie committed Jan 30, 2018
1 parent 4e15e79 commit b6ebaba
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions modules/packetizer/hevc.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,19 @@ static bool InsertXPS(decoder_t *p_dec, uint8_t i_nal_type, uint8_t i_id,
return false;
}

/* Check if we really need to re-decode/replace */
if(*pp_nal)
{
const uint8_t *p_stored = (*pp_nal)->p_buffer;
size_t i_stored = (*pp_nal)->i_buffer;
hxxx_strip_AnnexB_startcode(&p_stored, &i_stored);
const uint8_t *p_new = p_nalb->p_buffer;
size_t i_new = p_nalb->i_buffer;
hxxx_strip_AnnexB_startcode(&p_new, &i_new);
if(i_stored == i_new && !memcmp(p_stored, p_new, i_new))
return true;
}

/* Free associated decoded version */
if(*pp_decoded)
{
Expand Down

0 comments on commit b6ebaba

Please sign in to comment.