Mercurial > mplayer.hg
comparison mplayer.c @ 7495:12b2c735ad07
removed -dapsync (obsolete code)
author | arpi |
---|---|
date | Mon, 23 Sep 2002 22:12:29 +0000 |
parents | 229287c14cd4 |
children | 6a2b6f3d619c |
comparison
equal
deleted
inserted
replaced
7494:229287c14cd4 | 7495:12b2c735ad07 |
---|---|
207 static float default_max_pts_correction=-1;//0.01f; | 207 static float default_max_pts_correction=-1;//0.01f; |
208 static float max_pts_correction=0;//default_max_pts_correction; | 208 static float max_pts_correction=0;//default_max_pts_correction; |
209 static float c_total=0; | 209 static float c_total=0; |
210 float audio_delay=0; | 210 float audio_delay=0; |
211 | 211 |
212 static int dapsync=0; | |
213 static int softsleep=0; | 212 static int softsleep=0; |
214 | 213 |
215 static float force_fps=0; | 214 static float force_fps=0; |
216 static int force_srate=0; | 215 static int force_srate=0; |
217 int frame_dropping=0; // option 0=no drop 1= drop vo 2= drop decode | 216 int frame_dropping=0; // option 0=no drop 1= drop vo 2= drop decode |
1608 | 1607 |
1609 if(sh_audio && !d_audio->eof){ | 1608 if(sh_audio && !d_audio->eof){ |
1610 float delay=audio_out->get_delay(); | 1609 float delay=audio_out->get_delay(); |
1611 mp_dbg(MSGT_AVSYNC,MSGL_DBG2,"delay=%f\n",delay); | 1610 mp_dbg(MSGT_AVSYNC,MSGL_DBG2,"delay=%f\n",delay); |
1612 | 1611 |
1613 if(!dapsync){ | |
1614 | |
1615 /* Arpi's AV-sync */ | |
1616 | |
1617 time_frame=sh_video->timer; | 1612 time_frame=sh_video->timer; |
1618 time_frame-=sh_audio->timer-delay; | 1613 time_frame-=sh_audio->timer-delay; |
1619 | 1614 |
1620 } else { // if(!dapsync) | 1615 // delay = amount of audio buffered in soundcard/driver |
1621 | |
1622 /* DaP's AV-sync */ | |
1623 | |
1624 float SH_AV_delay; | |
1625 /* SH_AV_delay = sh_video->timer - (sh_audio->timer - (float)((float)delay + sh_audio->a_buffer_len) / (float)sh_audio->o_bps); */ | |
1626 SH_AV_delay = sh_video->timer - (sh_audio->timer - (float)((float)delay) / (float)sh_audio->o_bps); | |
1627 // printf ("audio slp req: %.3f TF: %.3f delta: %.3f (v: %.3f a: %.3f) | ", i, time_frame, | |
1628 // i - time_frame, sh_video->timer, sh_audio->timer - (float)((float)delay / (float)sh_audio->o_bps)); | |
1629 if(SH_AV_delay<-2*frame_time){ | |
1630 drop_frame=frame_dropping; // tricky! | |
1631 ++drop_frame_cnt; | |
1632 mp_msg(MSGT_AVSYNC,MSGL_INFO,"A-V SYNC: FRAMEDROP (SH_AV_delay=%.3f)!\n", SH_AV_delay); | |
1633 mp_msg(MSGT_AVSYNC,MSGL_DBG2,"\nframe drop %d, %.2f\n", drop_frame, time_frame); | |
1634 /* go into unlimited-TF cycle */ | |
1635 time_frame = SH_AV_delay; | |
1636 } else { | |
1637 #define SL_CORR_AVG_LEN 125 | |
1638 /* don't adjust under framedropping */ | |
1639 time_frame_corr_avg = (time_frame_corr_avg * (SL_CORR_AVG_LEN - 1) + | |
1640 (SH_AV_delay - time_frame)) / SL_CORR_AVG_LEN; | |
1641 #define UNEXP_CORR_MAX 0.1 /* limit of unexpected correction between two frames (percentage) */ | |
1642 #define UNEXP_CORR_WARN 1.0 /* warn limit of A-V lag (percentage) */ | |
1643 time_frame += time_frame_corr_avg; | |
1644 // printf ("{%.3f - %.3f}\n", i - time_frame, frame_time + frame_time_corr_avg); | |
1645 if (SH_AV_delay - time_frame < (frame_time + time_frame_corr_avg) * UNEXP_CORR_MAX && | |
1646 SH_AV_delay - time_frame > (frame_time + time_frame_corr_avg) * -UNEXP_CORR_MAX) | |
1647 time_frame = SH_AV_delay; | |
1648 else { | |
1649 if (SH_AV_delay - time_frame > (frame_time + time_frame_corr_avg) * UNEXP_CORR_WARN || | |
1650 SH_AV_delay - time_frame < (frame_time + time_frame_corr_avg) * -UNEXP_CORR_WARN) | |
1651 mp_msg(MSGT_AVSYNC, MSGL_WARN, "WARNING: A-V SYNC LAG TOO LARGE: %.3f {%.3f - %.3f} (too little UNEXP_CORR_MAX?)\n", | |
1652 SH_AV_delay - time_frame, SH_AV_delay, time_frame); | |
1653 time_frame += (frame_time + time_frame_corr_avg) * ((SH_AV_delay > time_frame) ? | |
1654 UNEXP_CORR_MAX : -UNEXP_CORR_MAX); | |
1655 } | |
1656 } /* /start dropframe */ | |
1657 | |
1658 } // if(dapsync) | |
1659 | |
1660 if(delay>0.25) delay=0.25; else | 1616 if(delay>0.25) delay=0.25; else |
1661 if(delay<0.10) delay=0.10; | 1617 if(delay<0.10) delay=0.10; |
1662 if(time_frame>delay*0.6){ | 1618 if(time_frame>delay*0.6){ |
1663 // sleep time too big - may cause audio drops (buffer underrun) | 1619 // sleep time too big - may cause audio drops (buffer underrun) |
1664 frame_time_remaining=1; | 1620 frame_time_remaining=1; |