Originally committed as revision 21585 to svn://svn.ffmpeg.org/ffmpeg/trunk
Unified · Split
| @@ -168,7 +168,7 @@ typedef struct VideoState { · 167 unmodified lines | ||
| 168 | 168 | AVStream *video_st; |
| 169 | 169 | PacketQueue videoq; |
| 170 | 170 | double video_current_pts; ///<current displayed pts (different from video_clock if frame fifos are used) |
| 171 | − int64_t video_current_pts_time; ///<time (av_gettime) at which we updated video_current_pts - used to have running video pts | |
| 171 | + double video_current_pts_drift; ///<video_current_pts - time (av_gettime) at which we updated video_current_pts - used to have running video pts | |
| 172 | 172 | VideoPicture pictq[VIDEO_PICTURE_QUEUE_SIZE]; |
| 173 | 173 | int pictq_size, pictq_rindex, pictq_windex; |
| 174 | 174 | SDL_mutex *pictq_mutex; |
| @@ -942,7 +942,7 @@ static double get_video_clock(VideoState *is) · 767 unmodified lines | ||
| 942 | 942 | if (is->paused) { |
| 943 | 943 | return is->video_current_pts; |
| 944 | 944 | } else { |
| 945 | − return is->video_current_pts + (av_gettime() - is->video_current_pts_time) / 1000000.0; | |
| 945 | + return is->video_current_pts_drift + av_gettime() / 1000000.0; | |
| 946 | 946 | } |
| 947 | 947 | } |
| 948 | 948 | |
| @@ -990,15 +990,14 @@ static void stream_seek(VideoState *is, int64_t pos, int64_t rel, int seek_by_by · 41 unmodified lines | ||
| 990 | 990 | /* pause or resume the video */ |
| 991 | 991 | static void stream_pause(VideoState *is) |
| 992 | 992 | { |
| 993 | − is->paused = !is->paused; | |
| 994 | − if (!is->paused) { | |
| 993 | + if (is->paused) { | |
| 994 | + is->frame_timer += av_gettime() / 1000000.0 + is->video_current_pts_drift - is->video_current_pts; | |
| 995 | 995 | if(is->read_pause_return != AVERROR(ENOSYS)){ |
| 996 | − is->video_current_pts = get_video_clock(is); | |
| 996 | + is->video_current_pts = is->video_current_pts_drift + av_gettime() / 1000000.0; | |
| 997 | 997 | } |
| 998 | − | |
| 999 | − is->frame_timer += (av_gettime() - is->video_current_pts_time) / 1000000.0; | |
| 1000 | − is->video_current_pts_time= av_gettime(); | |
| 998 | + is->video_current_pts_drift = is->video_current_pts - av_gettime() / 1000000.0; | |
| 1001 | 999 | } |
| 1000 | + is->paused = !is->paused; | |
| 1002 | 1001 | } |
| 1003 | 1002 | |
| 1004 | 1003 | static double compute_frame_delay(double frame_current_pts, VideoState *is) |
| @@ -1070,7 +1069,7 @@ static void video_refresh_timer(void *opaque) · 65 unmodified lines | ||
| 1070 | 1069 | |
| 1071 | 1070 | /* update current video pts */ |
| 1072 | 1071 | is->video_current_pts = vp->pts; |
| 1073 | − is->video_current_pts_time = av_gettime(); | |
| 1072 | + is->video_current_pts_drift = is->video_current_pts - av_gettime() / 1000000.0; | |
| 1074 | 1073 | |
| 1075 | 1074 | /* launch timer for next picture */ |
| 1076 | 1075 | schedule_refresh(is, (int)(compute_frame_delay(vp->pts, is) * 1000 + 0.5)); |
| @@ -1795,7 +1794,7 @@ static int stream_component_open(VideoState *is, int stream_index) · 718 unmodified lines | ||
| 1795 | 1794 | |
| 1796 | 1795 | is->frame_last_delay = 40e-3; |
| 1797 | 1796 | is->frame_timer = (double)av_gettime() / 1000000.0; |
| 1798 | − is->video_current_pts_time = av_gettime(); | |
| 1797 | +// is->video_current_pts_time = av_gettime(); | |
| 1799 | 1798 | |
| 1800 | 1799 | packet_queue_init(&is->videoq); |
| 1801 | 1800 | is->video_tid = SDL_CreateThread(video_thread, is); |