Always set the packet stream_index to the id of the output stream.

This commit is contained in:
Isaac Connor 2017-08-02 16:23:37 -04:00
parent 3b97fdadc4
commit 7e5edf1623
1 changed files with 2 additions and 9 deletions

View File

@ -698,13 +698,7 @@ int VideoStore::writeVideoFramePacket( AVPacket *ipkt ) {
opkt.data = ipkt->data; opkt.data = ipkt->data;
opkt.size = ipkt->size; 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 opkt.stream_index = video_output_stream->index;
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;
}
AVPacket safepkt; AVPacket safepkt;
memcpy( &safepkt, &opkt, sizeof(AVPacket) ); memcpy( &safepkt, &opkt, sizeof(AVPacket) );
@ -929,8 +923,7 @@ int VideoStore::writeAudioFramePacket( AVPacket *ipkt ) {
// pkt.pos: byte position in stream, -1 if unknown // pkt.pos: byte position in stream, -1 if unknown
opkt.pos = -1; opkt.pos = -1;
opkt.stream_index = ipkt->stream_index; opkt.stream_index = audio_output_stream->index;//ipkt->stream_index;
Debug(2, "Stream index is %d", opkt.stream_index );
AVPacket safepkt; AVPacket safepkt;
memcpy(&safepkt, &opkt, sizeof(AVPacket)); memcpy(&safepkt, &opkt, sizeof(AVPacket));