Fix using wrong stream to set codec_type
parent
8a33fb6665
commit
253ed928ec
|
@ -192,7 +192,6 @@ int FfmpegCamera::Capture(ZMPacket &zm_packet) {
|
|||
|
||||
int ret;
|
||||
|
||||
AVStream *stream;
|
||||
if ( mSecondFormatContext and
|
||||
(
|
||||
av_rescale_q(mLastAudioPTS, mAudioStream->time_base, AV_TIME_BASE_Q)
|
||||
|
@ -201,17 +200,14 @@ int FfmpegCamera::Capture(ZMPacket &zm_packet) {
|
|||
) ) {
|
||||
// if audio stream is behind video stream, then read from audio, otherwise video
|
||||
mFormatContextPtr = mSecondFormatContext;
|
||||
stream = mAudioStream;
|
||||
Debug(1, "Using audio input");
|
||||
} else {
|
||||
|
||||
mFormatContextPtr = mFormatContext;
|
||||
stream = mVideoStream;
|
||||
Debug(1, "Using video input beacuse %" PRId64 " >= %" PRId64,
|
||||
av_rescale_q(mLastAudioPTS, mAudioStream->time_base, AV_TIME_BASE_Q),
|
||||
av_rescale_q(mLastVideoPTS, mVideoStream->time_base, AV_TIME_BASE_Q)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ( (ret = av_read_frame(mFormatContextPtr, &packet)) < 0 ) {
|
||||
if (
|
||||
|
@ -228,6 +224,9 @@ int FfmpegCamera::Capture(ZMPacket &zm_packet) {
|
|||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
AVStream *stream = mFormatContextPtr->streams[packet.stream_index];
|
||||
ZM_DUMP_STREAM_PACKET(stream, packet, "ffmpeg_camera in");
|
||||
|
||||
#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0)
|
||||
|
|
Loading…
Reference in New Issue