Commit 322f0f59 authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/flvdec: do not inject dts=0 metadata packets which failed to be...

avformat/flvdec: do not inject dts=0 metadata packets which failed to be parsed into a new data stream

Such data streams (which then contain no other packets except the faulty one)
confuse some user applications, like VLC
Works around vlcticket 12389
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 5c37ffca
......@@ -566,13 +566,13 @@ static int flv_read_metabody(AVFormatContext *s, int64_t next_pos)
type = avio_r8(ioc);
if (type != AMF_DATA_TYPE_STRING ||
amf_get_string(ioc, buffer, sizeof(buffer)) < 0)
return -1;
return 2;
if (!strcmp(buffer, "onTextData"))
return 1;
if (strcmp(buffer, "onMetaData") && strcmp(buffer, "onCuePoint"))
return -1;
return 2;
// find the streams now so that amf_parse_object doesn't need to do
// the lookup every time it is called.
......@@ -830,7 +830,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
stream_type=FLV_STREAM_TYPE_DATA;
if (size > 13 + 1 + 4 && dts == 0) { // Header-type metadata stuff
meta_pos = avio_tell(s->pb);
if (flv_read_metabody(s, next) == 0) {
if (flv_read_metabody(s, next) <= 0) {
goto skip;
}
avio_seek(s->pb, meta_pos, SEEK_SET);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment