@@ -257,6 +257,7 @@ typedef struct VideoState {
struct SwrContext *swr_ctx;
int frame_drops_early;
int frame_drops_late;
+ int drop_disposable;
enum ShowMode {
SHOW_MODE_NONE = -1, SHOW_MODE_VIDEO = 0, SHOW_MODE_WAVES, SHOW_MODE_RDFT, SHOW_MODE_NB
@@ -1619,9 +1620,11 @@ retry:
duration = vp_duration(is, vp, nextvp);
if(!is->step && (framedrop>0 || (framedrop && get_master_sync_type(is) != AV_SYNC_VIDEO_MASTER)) && time > is->frame_timer + duration){
is->frame_drops_late++;
+ is->drop_disposable = 1;
frame_queue_next(&is->pictq);
goto retry;
}
+ is->drop_disposable = 0;
}
if (is->subtitle_st) {
@@ -2900,6 +2903,7 @@ static int read_thread(void *arg)
infinite_buffer = 1;
for (;;) {
+ AVStream * st;
if (is->abort_request)
break;
if (is->paused != is->last_paused) {
@@ -3008,6 +3012,12 @@ static int read_thread(void *arg)
} else {
is->eof = 0;
}
+ st = ic->streams[pkt->stream_index];
+ if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
+ is->drop_disposable && pkt->flags & AV_PKT_FLAG_DISPOSABLE) {
+ av_packet_unref(pkt);
+ continue;
+ }
/* check if packet is in play range specified by user, then queue, otherwise discard */
stream_start_time = ic->streams[pkt->stream_index]->start_time;
pkt_ts = pkt->pts == AV_NOPTS_VALUE ? pkt->dts : pkt->pts;