}
/****************************************************************************/
-void
+static void
update_progress_bar(gfloat percentage)
{
start_timestamp = 0;
/* we update the progress bar 100 times */
+
+ /* Update the progress bar when it gets to this value. */
+ progbar_nextstep = 0;
+ /* When we reach the value that triggers a progress bar update,
+ bump that value by this amount. */
progbar_quantum = total_packets/100;
- progbar_nextstep = progbar_count;
status = S_NORMAL;
/****************************************************************************/
static void channel_draw(rtp_channel_info_t* rci)
{
- int i,j;
+ int i, imax;
+ int j;
sample_t sample;
SAMPLE min, max;
PangoLayout *small_layout;
rci->draw_area->allocation.width,
rci->draw_area->allocation.height-HEIGHT_TIME_LABEL);
+ imax = min(rci->draw_area->allocation.width,(gint)(rci->samples->len/MULT));
+
/* we update the progress bar 100 times */
- progbar_quantum = (total_frames/MULT)/100;
- progbar_nextstep = progbar_count;
+
+ /* Update the progress bar when it gets to this value. */
+ progbar_nextstep = 0;
+ /* When we reach the value that triggers a progress bar update,
+ bump that value by this amount. */
+ progbar_quantum = imax/100;
red_gc = gdk_gc_new(rci->draw_area->window);
gdk_gc_set_rgb_fg_color(red_gc, &red_color);
- for (i=0; i< min(rci->draw_area->allocation.width,(gint)(rci->samples->len/MULT)); i++) {
+ for (i=0; i< imax; i++) {
sample.val = 0;
status = S_NORMAL;
max=(SAMPLE)0xFFFF;
if (progbar_count >= progbar_nextstep) {
g_assert(total_frames > 0);
- progbar_val = (gfloat) progbar_count / (total_frames/MULT);
+ progbar_val = (gfloat) i / imax;
update_progress_bar(progbar_val);