Skip to content

Commit dbc7be4

Browse files
committed
demuxer: fix the wrong stream index which cause crash
1 parent 1ebc6dd commit dbc7be4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/AVDemuxer.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ bool AVDemuxer::readFrame()
6363
qDebug("End of file. %s %d", __FUNCTION__, __LINE__);
6464
emit finished();
6565
}
66+
//pkt->data = QByteArray(); //flush
67+
//return true;
6668
return false; //frames after eof are eof frames
6769
} else if (ret == AVERROR_INVALIDDATA) {
6870
qWarning("AVERROR_INVALIDDATA");
@@ -434,19 +436,17 @@ void AVDemuxer::dump()
434436
AVStream *stream = 0;
435437
for (int idx = 0; stream_infos[idx].name != 0; ++idx) {
436438
qDebug("%s: %d", stream_infos[idx].name, stream_infos[idx].index);
437-
if (stream_infos[idx].index < 0 || !(stream = format_context->streams[idx])) {
439+
if (stream_infos[idx].index < 0 || !(stream = format_context->streams[stream_infos[idx].index])) {
438440
qDebug("stream not available: index = %d, stream = %p", stream_infos[idx].index, stream);
439441
continue;
440442
}
441-
//why not fixed for video without audio?
442-
//qDebug("[AVStream::start_time = %lld]", stream->start_time);
443+
qDebug("[AVStream::start_time = %lld]", stream->start_time);
443444
AVCodecContext *ctx = stream_infos[idx].ctx;
444445
if (ctx) {
445446
qDebug("[AVCodecContext::time_base = %d / %d = %f]", ctx->time_base.num, ctx->time_base.den, av_q2d(ctx->time_base));
446447
}
447-
////why avg_frame_rate is not fixed for the same video?
448-
//qDebug("[AVStream::avg_frame_rate = %d / %d = %f]", stream->avg_frame_rate.num, stream->avg_frame_rate.den, av_q2d(stream->avg_frame_rate));
449-
//qDebug("[AVStream::time_base = %d / %d = %f]", stream->time_base.num, stream->time_base.den, av_q2d(stream->time_base));
448+
qDebug("[AVStream::avg_frame_rate = %d / %d = %f]", stream->avg_frame_rate.num, stream->avg_frame_rate.den, av_q2d(stream->avg_frame_rate));
449+
qDebug("[AVStream::time_base = %d / %d = %f]", stream->time_base.num, stream->time_base.den, av_q2d(stream->time_base));
450450
}
451451

452452
}

0 commit comments

Comments
 (0)