summaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorRoman Arutyunyan <arutyunyan.roman@gmail.com>2012-09-01 13:04:57 +0400
committerMichael Niedermayer <michaelni@gmx.at>2012-09-01 17:49:33 +0200
commitc0daa73a0f8dcc695c27ed1029d8aa69f2968686 (patch)
tree88cacedd65ff9912f94d29fb6bff236e4446bb81 /libavformat
parent5081310b58d2530fd17605240613d8689b702a35 (diff)
downloadffmpeg-streaming-c0daa73a0f8dcc695c27ed1029d8aa69f2968686.zip
ffmpeg-streaming-c0daa73a0f8dcc695c27ed1029d8aa69f2968686.tar.gz
fix flv new stream handling after head already parsed
This fixes stream lookup in flv demuxer. When used with librtmp protocol streams are sometimes added after head arrived. If the first stream added in flv header reader is Audio stream then it is messed with Video stream added later in the code patched. The result is I have 2 Audio streams (first of them is said to have a video codec like h264) instead of Audio/Video pair. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/flvdec.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 43a3723..822f381 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -709,13 +709,15 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
/* now find stream */
for(i=0;i<s->nb_streams;i++) {
st = s->streams[i];
- if (stream_type == FLV_STREAM_TYPE_AUDIO && st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
- if (flv_same_audio_codec(st->codec, flags)) {
+ if (stream_type == FLV_STREAM_TYPE_AUDIO) {
+ if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO &&
+ flv_same_audio_codec(st->codec, flags)) {
break;
}
} else
- if (stream_type == FLV_STREAM_TYPE_VIDEO && st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
- if (flv_same_video_codec(st->codec, flags)) {
+ if (stream_type == FLV_STREAM_TYPE_VIDEO) {
+ if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
+ flv_same_video_codec(st->codec, flags)) {
break;
}
} else if (st->id == stream_type) {
OpenPOWER on IntegriCloud