aizvorski / h264bitstream

A complete set of functions to read and write H.264 video bitstreams, in particular to examine or modify headers.
GNU Lesser General Public License v2.1
713 stars 237 forks source link

sps_table support is broken, complete failure when seq_parameter_set_id != 0 #12

Open ydirson opened 8 years ago

ydirson commented 8 years ago

The memcpy at the end of read_seq_parameter_set_rbsp() overwrites the struct it just filled with a copy of what's in sps_table. Since h->sps == h->sps_table[0] it just filled that one, the memcpy in the id=0 case is (un?)luckily a no-op, while in all other cases the values just read are just all cleared to 0.

Swapping src/dst can't work properly as is either, since h->sps == h->sps_table[0]: when we notice that seq_parameter_set_id != 0 we have already overwritten h->sps_table[0].

if(0)-ing this memcpy as a workaround works much better...

aizvorski commented 7 years ago

@ydirson I see what you mean! I think the code in PR #17 fixes that, could you give it a try?

aizvorski commented 7 years ago

@ydirson Latest code in master should behave ok now. Could you test it, or give an example file to test with?