summaryrefslogtreecommitdiff
path: root/ffplay.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-02-01 01:52:07 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-02-02 02:50:33 +0100
commit17d87571c83177ca60527de8f8919ba5050158d5 (patch)
treede2874d1701a8b231b6e5dace1c1e47423e305f6 /ffplay.c
parent71e2cb4706c997171856cb9c43db98eba3f8f7eb (diff)
downloadffmpeg-17d87571c83177ca60527de8f8919ba5050158d5.tar.gz
ffplay: Fallback to dts if pts is unavailable in pkt_in_play_range calculation
Reviewed-by: Marton Balint <cus@passwd.hu> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffplay.c')
-rw-r--r--ffplay.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ffplay.c b/ffplay.c
index 72ec35dbf4..c112eada60 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -2881,6 +2881,7 @@ static int read_thread(void *arg)
int orig_nb_streams;
SDL_mutex *wait_mutex = SDL_CreateMutex();
int scan_all_pmts_set = 0;
+ int64_t pkt_ts;
memset(st_index, -1, sizeof(st_index));
is->last_video_stream = is->video_stream = -1;
@@ -3143,8 +3144,9 @@ static int read_thread(void *arg)
}
/* 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;
pkt_in_play_range = duration == AV_NOPTS_VALUE ||
- (pkt->pts - (stream_start_time != AV_NOPTS_VALUE ? stream_start_time : 0)) *
+ (pkt_ts - (stream_start_time != AV_NOPTS_VALUE ? stream_start_time : 0)) *
av_q2d(ic->streams[pkt->stream_index]->time_base) -
(double)(start_time != AV_NOPTS_VALUE ? start_time : 0) / 1000000
<= ((double)duration / 1000000);