diff options
author | Thibaut Mattern <tmattern@users.sourceforge.net> | 2003-02-18 23:15:07 +0000 |
---|---|---|
committer | Thibaut Mattern <tmattern@users.sourceforge.net> | 2003-02-18 23:15:07 +0000 |
commit | 7203480a9e69f5501d8c25275062a0143cb2fbc1 (patch) | |
tree | 2ccd41832c4d6bee57c5382e8d96cdb76e4bfd00 | |
parent | fc7503c9e39e866b2a41cdb643d9c5fc236cddc9 (diff) | |
download | xine-lib-7203480a9e69f5501d8c25275062a0143cb2fbc1.tar.gz xine-lib-7203480a9e69f5501d8c25275062a0143cb2fbc1.tar.bz2 |
- Don't report twice the same number.
- Report a progress even if the bitrate is not known
CVS patchset: 4197
CVS date: 2003/02/18 23:15:07
-rw-r--r-- | src/input/net_buf_ctrl.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/input/net_buf_ctrl.c b/src/input/net_buf_ctrl.c index 22dbb4c2b..0ec6d713d 100644 --- a/src/input/net_buf_ctrl.c +++ b/src/input/net_buf_ctrl.c @@ -47,6 +47,7 @@ struct nbc_s { int low_water_mark; int high_water_mark; int fifo_full; + int progress; }; @@ -73,6 +74,8 @@ void nbc_check_buffers (nbc_t *this) { int data_length, video_data_length, audio_data_length; /* fifo length in second */ uint32_t video_data_size, audio_data_size; /* fifo size in bytes */ int video_bitrate, audio_bitrate; + int progress; + int video_fifo_progress, audio_fifo_progress; video_fifo_fill = this->stream->video_fifo->size(this->stream->video_fifo); if (this->stream->audio_fifo) @@ -84,7 +87,7 @@ void nbc_check_buffers (nbc_t *this) { /* start buffering if fifos are empty */ if (fifo_fill == 0) { - if (!this->buffering) { + if (!this->buffering) { /* increase/decrease marks to adapt to stream/network needs */ if (!this->fifo_full) { @@ -94,6 +97,7 @@ void nbc_check_buffers (nbc_t *this) { this->high_water_mark -= this->high_water_mark / 8; } this->buffering = 1; + this->progress = 0; report_progress (this->stream, 0); } @@ -151,7 +155,20 @@ void nbc_check_buffers (nbc_t *this) { this->buffering = 0; this->fifo_full = (data_length < this->high_water_mark); } else { - report_progress (this->stream, (data_length * 100) / this->high_water_mark); + progress = (data_length * 100) / this->high_water_mark; + + if (!progress) { + /* bitrate is not known */ + video_fifo_progress = (100 * video_fifo_fill) / VIDEO_FIFO_BUFS; + audio_fifo_progress = (100 * audio_fifo_fill) / AUDIO_FIFO_BUFS; + progress = (video_fifo_progress > audio_fifo_progress)? + video_fifo_progress : audio_fifo_progress; + } + + if (progress != this->progress) { + report_progress (this->stream, progress); + this->progress = progress; + } } } else { @@ -174,6 +191,7 @@ nbc_t *nbc_init (xine_stream_t *stream) { this->buffering = 0; this->low_water_mark = DEFAULT_LOW_WATER_MARK; this->high_water_mark = DEFAULT_HIGH_WATER_MARK; + this->progress = 0; return this; } |