diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index f4447b61ecc6f21a0205e7634334458b95671f05..940d4dda456994a2251cdf1e4a815330bbd6da82 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -847,7 +847,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
                 int type;
                 meta_pos = avio_tell(s->pb);
                 type = flv_read_metabody(s, next);
-                if (type == 0 && dts == 0 || type < 0) {
+                if (type == 0 && dts == 0 || type < 0 || type == TYPE_UNKNOWN) {
                     goto skip;
                 } else if (type == TYPE_ONTEXTDATA) {
                     avpriv_request_sample(s, "OnTextData packet");