From 7e5edf1623878dc6376e2dbb5c05128e384ec6fc Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 2 Aug 2017 16:23:37 -0400 Subject: [PATCH] Always set the packet stream_index to the id of the output stream. --- src/zm_videostore.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/zm_videostore.cpp b/src/zm_videostore.cpp index 2fd710dd8..4df2d902d 100644 --- a/src/zm_videostore.cpp +++ b/src/zm_videostore.cpp @@ -698,13 +698,7 @@ int VideoStore::writeVideoFramePacket( AVPacket *ipkt ) { opkt.data = ipkt->data; opkt.size = ipkt->size; - // Some camera have audio on stream 0 and video on stream 1. So when we remove the audio, video stream has to go on 0 - if ( ipkt->stream_index > 0 and ! audio_output_stream ) { - Debug(1,"Setting stream index to 0 instead of %d", ipkt->stream_index ); - opkt.stream_index = 0; - } else { - opkt.stream_index = ipkt->stream_index; - } + opkt.stream_index = video_output_stream->index; AVPacket safepkt; memcpy( &safepkt, &opkt, sizeof(AVPacket) ); @@ -929,8 +923,7 @@ int VideoStore::writeAudioFramePacket( AVPacket *ipkt ) { // pkt.pos: byte position in stream, -1 if unknown opkt.pos = -1; - opkt.stream_index = ipkt->stream_index; - Debug(2, "Stream index is %d", opkt.stream_index ); + opkt.stream_index = audio_output_stream->index;//ipkt->stream_index; AVPacket safepkt; memcpy(&safepkt, &opkt, sizeof(AVPacket));