flvdec: Don't read the VP6 header byte when setting codec type based on metadata

This header byte is only present when actually reading a VP6 frame,
not when reading the codec type field in the metadata. This
potential bug has been present since 5b54a90c.

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
flvdec: Check the return value of a malloc

The callers of this function can't report errors sanely. If this
one malloc fails, don't write the extradata byte, make sure we
try to malloc it the next time we're called instead, and make sure
we still consume the input data byte.

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
h264: do not copy ref count/ref2frm when updating per-frame context

They are filled in decode_slice_header() anyway.
h264: on reference overflow, reset the reference count to 0, not 1.

Since decode_slice_header() returns before the reference lists are
constructed, there are zero valid references.

CC:libav-stable@libav.org
h264: set ref_count to 0 for intra slices.

CC:libav-stable@libav.org
Merge commit 'c91c63b5380bf79655c09320774a022f84d76fd5'

* commit 'c91c63b5380bf79655c09320774a022f84d76fd5':
  flvdec: Don't read the VP6 header byte when setting codec type based on metadata

Conflicts:
	libavformat/flvdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
Merge commit 'e671d3ad6cd7fe1d02e9b35b889a25d8c059fce9'

* commit 'e671d3ad6cd7fe1d02e9b35b889a25d8c059fce9':
  h264: do not copy ref count/ref2frm when updating per-frame context
  flvdec: Check the return value of a malloc

Conflicts:
	libavformat/flvdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
Merge commit '668e16a0dd1ff56d4beeff5c658d8a2a08dbfac8'

* commit '668e16a0dd1ff56d4beeff5c658d8a2a08dbfac8':
  h264: on reference overflow, reset the reference count to 0, not 1.

Conflicts:
	libavcodec/h264.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
Merge remote-tracking branch 'qatar/master'

* qatar/master:
  h264: set ref_count to 0 for intra slices.

Conflicts:
	libavcodec/h264.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
er: Fix slice threading check

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>