[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[178] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2012-10-20 07:45:21
|
Revision: 178 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=178&view=rev Author: nickols_k Date: 2012-10-20 07:45:14 +0000 (Sat, 20 Oct 2012) Log Message: ----------- more correct computing of decoder outrun Modified Paths: -------------- mplayerxp/dec_ahead.c mplayerxp/dec_ahead.h mplayerxp/mplayer.c Modified: mplayerxp/dec_ahead.c =================================================================== --- mplayerxp/dec_ahead.c 2012-10-19 17:06:52 UTC (rev 177) +++ mplayerxp/dec_ahead.c 2012-10-20 07:45:14 UTC (rev 178) @@ -94,6 +94,12 @@ unsigned dae_next_played(const dec_ahead_engine_t* it) { return (it->player_idx+1)%it->nframes; } unsigned dae_next_decoded(const dec_ahead_engine_t* it) { return (it->decoder_idx+1)%it->nframes; } +unsigned dae_get_decoder_outrun(const dec_ahead_engine_t* it) { + unsigned decoder_idx=it->decoder_idx; + if(decoder_idx<it->player_idx) decoder_idx+=it->nframes; + return decoder_idx-it->player_idx; +} + frame_attr_t dae_played_fra(const dec_ahead_engine_t* it) { unsigned idx=it->player_idx; return it->fra[idx]; @@ -385,7 +391,7 @@ ,abs_dec_ahead_blitted_frame,abs_dec_ahead_locked_frame,lda_active_frame+xp_num_frames-2); if(output_quality) { unsigned total = xp_num_frames/2; - unsigned distance = dae_curr_vdecoded()-dae_curr_vplayed(); + unsigned distance = dae_get_decoder_outrun(xp_core.video); int our_quality; our_quality = output_quality*distance/total; if(drop_param) set_video_quality(sh_video,0); @@ -753,7 +759,7 @@ if(xp_core.has_video) { /* Match video buffer */ - vbuf_size = dae_curr_vdecoded() - dae_curr_vplayed(); + vbuf_size = dae_get_decoder_outrun(xp_core.video); pref_buf = vbuf_size / vo.fps * sh_audio->af_bps; pref_buf -= len; if( pref_buf > 0 ) { Modified: mplayerxp/dec_ahead.h =================================================================== --- mplayerxp/dec_ahead.h 2012-10-19 17:06:52 UTC (rev 177) +++ mplayerxp/dec_ahead.h 2012-10-20 07:45:14 UTC (rev 178) @@ -43,6 +43,7 @@ long long int num_decoded_frames; /* for frame dropping */ }dec_ahead_engine_t; + typedef struct xp_core_s { int has_video; int has_audio; @@ -72,6 +73,8 @@ extern unsigned dae_prev_decoded(const dec_ahead_engine_t* it); extern unsigned dae_next_played(const dec_ahead_engine_t* it); extern unsigned dae_next_decoded(const dec_ahead_engine_t* it); +/* returns normalized decoder_idx-player_idx */ +extern unsigned dae_get_decoder_outrun(const dec_ahead_engine_t* it); static inline unsigned dae_curr_vplayed() { return xp_core.video->player_idx; } static inline unsigned dae_curr_vdecoded() { return xp_core.video->decoder_idx; } Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-19 17:06:52 UTC (rev 177) +++ mplayerxp/mplayer.c 2012-10-20 07:45:14 UTC (rev 178) @@ -2732,7 +2732,7 @@ if(sh_video) { do { usleep(0); - }while(dae_curr_vdecoded() < xp_num_frames/2 && !xp_eof); + }while(dae_get_decoder_outrun(xp_core.video) < xp_num_frames/2 && !xp_eof); } if(run_xp_players()!=0) exit_player("Can't run xp players!\n"); MSG_OK("Using the next %i threads:\n",xp_threads); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |