From 330b9f871d2d094c48741fdd808293249422c0cb Mon Sep 17 00:00:00 2001 From: Thulinma Date: Wed, 19 Mar 2014 10:16:05 +0100 Subject: [PATCH] Fixed FLV::Tag.offset() return value for non-H264 packets. --- lib/flv_tag.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/flv_tag.cpp b/lib/flv_tag.cpp index 0f85ffcf..2ef904c9 100644 --- a/lib/flv_tag.cpp +++ b/lib/flv_tag.cpp @@ -265,7 +265,11 @@ std::string FLV::Tag::tagType(){ /// Returns the 24-bit offset of this tag. /// Returns 0 if the tag isn't H264 int FLV::Tag::offset(){ - return (((data[13] << 16) + (data[14] << 8) + data[15]) << 8) >> 8; + if ((data[11] & 0x0F) == 7){ + return (((data[13] << 16) + (data[14] << 8) + data[15]) << 8) >> 8; + }else{ + return 0; + } } //offset getter /// Sets the 24-bit offset of this tag.