[vlc-commits] packetizer: h2xx: switch DCR test to negated AnnexB extradata test
Francois Cartegnie
git at videolan.org
Mon Sep 12 14:09:34 CEST 2016
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Sep 12 14:07:06 2016 +0200| [f2c4e194421790d4a9dfdb24aeffa7b80bd5a401] | committer: Francois Cartegnie
packetizer: h2xx: switch DCR test to negated AnnexB extradata test
As some encoders do set something else than bits to 1 into reserved
fields.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f2c4e194421790d4a9dfdb24aeffa7b80bd5a401
---
modules/packetizer/h264_nal.c | 7 +++++--
modules/packetizer/hevc_nal.h | 8 +++++---
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/modules/packetizer/h264_nal.c b/modules/packetizer/h264_nal.c
index cffa112..6c5aa47 100644
--- a/modules/packetizer/h264_nal.c
+++ b/modules/packetizer/h264_nal.c
@@ -37,10 +37,13 @@
bool h264_isavcC( const uint8_t *p_buf, size_t i_buf )
{
return ( i_buf >= H264_MIN_AVCC_SIZE &&
- p_buf[0] == 0x01 &&
+ p_buf[0] != 0x00 &&
+ p_buf[1] != 0x00
+/* /!\Broken quicktime streams does not respect reserved bits
(p_buf[4] & 0xFC) == 0xFC &&
(p_buf[4] & 0x03) != 0x02 &&
- (p_buf[5] & 0x1F) > 0x00 ); /* Broken quicktime streams using reserved bits */
+ (p_buf[5] & 0x1F) > 0x00 */
+ );
}
static size_t get_avcC_to_AnnexB_NAL_size( const uint8_t *p_buf, size_t i_buf )
diff --git a/modules/packetizer/hevc_nal.h b/modules/packetizer/hevc_nal.h
index b180f12..fc64112 100644
--- a/modules/packetizer/hevc_nal.h
+++ b/modules/packetizer/hevc_nal.h
@@ -121,13 +121,15 @@ enum hevc_slice_type_e
static inline bool hevc_ishvcC( const uint8_t *p_buf, size_t i_buf )
{
return ( i_buf >= HEVC_MIN_HVCC_SIZE &&
- p_buf[0] == 0x01 &&
- (p_buf[13] & 0xF0) == 0xF0 && /* Match all reserved bits */
+ p_buf[0] != 0x00 &&
+ p_buf[1] != 0x00
+/* /!\Broken quicktime streams does not respect reserved bits
+ (p_buf[13] & 0xF0) == 0xF0 && // Match all reserved bits
(p_buf[15] & 0xFC) == 0xFC &&
(p_buf[16] & 0xFC) == 0xFC &&
(p_buf[17] & 0xF8) == 0xF8 &&
(p_buf[18] & 0xF8) == 0xF8 &&
- (p_buf[21] & 0x03) != 0x02
+ (p_buf[21] & 0x03) != 0x02 */
);
}
More information about the vlc-commits
mailing list