Originally committed as revision 22536 to svn://svn.ffmpeg.org/ffmpeg/trunk
Alexander Strange authored on 2010/03/15 11:32:21... | ... |
@@ -900,6 +900,7 @@ static void do_video_out(AVFormatContext *s, |
900 | 900 |
AVFrame *final_picture, *formatted_picture, *resampling_dst, *padding_src; |
901 | 901 |
AVFrame picture_crop_temp, picture_pad_temp; |
902 | 902 |
AVCodecContext *enc, *dec; |
903 |
+ double sync_ipts; |
|
903 | 904 |
|
904 | 905 |
avcodec_get_frame_defaults(&picture_crop_temp); |
905 | 906 |
avcodec_get_frame_defaults(&picture_pad_temp); |
... | ... |
@@ -907,6 +908,8 @@ static void do_video_out(AVFormatContext *s, |
907 | 907 |
enc = ost->st->codec; |
908 | 908 |
dec = ist->st->codec; |
909 | 909 |
|
910 |
+ sync_ipts = get_sync_ipts(ost) / av_q2d(enc->time_base); |
|
911 |
+ |
|
910 | 912 |
/* by default, we output a single frame */ |
911 | 913 |
nb_frames = 1; |
912 | 914 |
|
... | ... |
@@ -914,7 +917,7 @@ static void do_video_out(AVFormatContext *s, |
914 | 914 |
|
915 | 915 |
if(video_sync_method){ |
916 | 916 |
double vdelta; |
917 |
- vdelta = get_sync_ipts(ost) / av_q2d(enc->time_base) - ost->sync_opts; |
|
917 |
+ vdelta = sync_ipts - ost->sync_opts; |
|
918 | 918 |
//FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c |
919 | 919 |
if (vdelta < -1.1) |
920 | 920 |
nb_frames = 0; |
... | ... |
@@ -922,7 +925,7 @@ static void do_video_out(AVFormatContext *s, |
922 | 922 |
if(vdelta<=-0.6){ |
923 | 923 |
nb_frames=0; |
924 | 924 |
}else if(vdelta>0.6) |
925 |
- ost->sync_opts= lrintf(get_sync_ipts(ost) / av_q2d(enc->time_base)); |
|
925 |
+ ost->sync_opts= lrintf(sync_ipts); |
|
926 | 926 |
}else if (vdelta > 1.1) |
927 | 927 |
nb_frames = lrintf(vdelta); |
928 | 928 |
//fprintf(stderr, "vdelta:%f, ost->sync_opts:%"PRId64", ost->sync_ipts:%f nb_frames:%d\n", vdelta, ost->sync_opts, get_sync_ipts(ost), nb_frames); |
... | ... |
@@ -936,7 +939,7 @@ static void do_video_out(AVFormatContext *s, |
936 | 936 |
fprintf(stderr, "*** %d dup!\n", nb_frames-1); |
937 | 937 |
} |
938 | 938 |
}else |
939 |
- ost->sync_opts= lrintf(get_sync_ipts(ost) / av_q2d(enc->time_base)); |
|
939 |
+ ost->sync_opts= lrintf(sync_ipts); |
|
940 | 940 |
|
941 | 941 |
nb_frames= FFMIN(nb_frames, max_frames[CODEC_TYPE_VIDEO] - ost->frame_number); |
942 | 942 |
if (nb_frames <= 0) |