mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 13:12:03 +00:00
update spandsp to use newest snapshot http://www.soft-switch.org/downloads/snapshots/spandsp/spandsp-20080910.tar.gz
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9493 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: media_monitor.cpp,v 1.4 2008/05/27 15:08:21 steveu Exp $
|
||||
* $Id: media_monitor.cpp,v 1.5 2008/09/08 16:10:41 steveu Exp $
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -50,34 +50,37 @@
|
||||
#include "spandsp.h"
|
||||
#include "media_monitor.h"
|
||||
|
||||
Fl_Double_Window *w;
|
||||
struct line_model_monitor_s
|
||||
{
|
||||
Fl_Double_Window *w;
|
||||
|
||||
Fl_Group *c_right;
|
||||
Fl_Group *c_sent;
|
||||
Fl_Group *c_received;
|
||||
Fl_Group *c_right;
|
||||
Fl_Group *c_sent;
|
||||
Fl_Group *c_received;
|
||||
|
||||
Ca_Canvas *canvas_sent;
|
||||
Ca_X_Axis *sent_x;
|
||||
Ca_Y_Axis *sent_y;
|
||||
Ca_Line *sent_re = NULL;
|
||||
double sent_re_plot[1000];
|
||||
double sent_re_plot_min;
|
||||
double sent_re_plot_max;
|
||||
Ca_Canvas *canvas_sent;
|
||||
Ca_X_Axis *sent_x;
|
||||
Ca_Y_Axis *sent_y;
|
||||
Ca_Line *sent_re;
|
||||
double sent_re_plot[1000];
|
||||
double sent_re_plot_min;
|
||||
double sent_re_plot_max;
|
||||
|
||||
Ca_Canvas *canvas_received;
|
||||
Ca_X_Axis *received_x;
|
||||
Ca_Y_Axis *received_y;
|
||||
Ca_Line *received_delays = NULL;
|
||||
double received_delays_plot[4000];
|
||||
double received_delays_plot_max;
|
||||
int min_diff;
|
||||
int max_diff;
|
||||
Ca_Canvas *canvas_received;
|
||||
Ca_X_Axis *received_x;
|
||||
Ca_Y_Axis *received_y;
|
||||
Ca_Line *received_delays;
|
||||
double received_delays_plot[4000];
|
||||
double received_delays_plot_max;
|
||||
int min_diff;
|
||||
int max_diff;
|
||||
|
||||
int highest_seq_no_seen = -1;
|
||||
int highest_seq_no_seen;
|
||||
};
|
||||
|
||||
static int skip = 0;
|
||||
|
||||
int in_ptr;
|
||||
static struct line_model_monitor_s media;
|
||||
static struct line_model_monitor_s *s = &media;
|
||||
|
||||
void media_monitor_rx(int seq_no, double departure_time, double arrival_time)
|
||||
{
|
||||
@@ -85,61 +88,61 @@ void media_monitor_rx(int seq_no, double departure_time, double arrival_time)
|
||||
int diff;
|
||||
int i;
|
||||
|
||||
if (received_delays)
|
||||
delete received_delays;
|
||||
if (s->received_delays)
|
||||
delete s->received_delays;
|
||||
|
||||
canvas_received->current(canvas_received);
|
||||
s->canvas_received->current(s->canvas_received);
|
||||
fdiff = (arrival_time - departure_time)*1000.0;
|
||||
diff = (int) fdiff;
|
||||
if (diff < 0)
|
||||
diff = 0;
|
||||
else if (diff > 1999)
|
||||
diff = 1999;
|
||||
received_delays_plot[2*diff + 1]++;
|
||||
if (received_delays_plot[2*diff + 1] > received_delays_plot_max)
|
||||
s->received_delays_plot[2*diff + 1]++;
|
||||
if (s->received_delays_plot[2*diff + 1] > s->received_delays_plot_max)
|
||||
{
|
||||
received_delays_plot_max = received_delays_plot[2*diff + 1];
|
||||
received_y->maximum(received_delays_plot_max);
|
||||
s->received_delays_plot_max = s->received_delays_plot[2*diff + 1];
|
||||
s->received_y->maximum(s->received_delays_plot_max);
|
||||
}
|
||||
if (diff > max_diff)
|
||||
if (diff > s->max_diff)
|
||||
{
|
||||
max_diff = diff;
|
||||
received_x->maximum((double) max_diff);
|
||||
s->max_diff = diff;
|
||||
s->received_x->maximum((double) s->max_diff);
|
||||
}
|
||||
if (diff < min_diff)
|
||||
if (diff < s->min_diff)
|
||||
{
|
||||
min_diff = diff - 1;
|
||||
received_x->minimum((double) min_diff);
|
||||
s->min_diff = diff - 1;
|
||||
s->received_x->minimum((double) s->min_diff);
|
||||
}
|
||||
|
||||
received_delays = new Ca_Line(2000, received_delays_plot, 0, 0, FL_BLUE, CA_NO_POINT);
|
||||
s->received_delays = new Ca_Line(2000, s->received_delays_plot, 0, 0, FL_BLUE, CA_NO_POINT);
|
||||
|
||||
if (sent_re)
|
||||
delete sent_re;
|
||||
if (s->sent_re)
|
||||
delete s->sent_re;
|
||||
|
||||
canvas_sent->current(canvas_sent);
|
||||
s->canvas_sent->current(s->canvas_sent);
|
||||
|
||||
if (seq_no > highest_seq_no_seen + 1)
|
||||
if (seq_no > s->highest_seq_no_seen + 1)
|
||||
{
|
||||
for (i = highest_seq_no_seen + 1; i < seq_no; i++)
|
||||
sent_re_plot[2*(i%500) + 1] = 0.0;
|
||||
for (i = s->highest_seq_no_seen + 1; i < seq_no; i++)
|
||||
s->sent_re_plot[2*(i%500) + 1] = 0.0;
|
||||
}
|
||||
sent_re_plot[2*(seq_no%500) + 1] = fdiff;
|
||||
s->sent_re_plot[2*(seq_no%500) + 1] = fdiff;
|
||||
|
||||
if (fdiff > sent_re_plot_max)
|
||||
if (fdiff > s->sent_re_plot_max)
|
||||
{
|
||||
sent_re_plot_max = fdiff;
|
||||
sent_y->maximum(sent_re_plot_max);
|
||||
s->sent_re_plot_max = fdiff;
|
||||
s->sent_y->maximum(s->sent_re_plot_max);
|
||||
}
|
||||
if (fdiff < sent_re_plot_min)
|
||||
if (fdiff < s->sent_re_plot_min)
|
||||
{
|
||||
sent_re_plot_min = fdiff - 1.0;
|
||||
sent_y->minimum(sent_re_plot_min);
|
||||
s->sent_re_plot_min = fdiff - 1.0;
|
||||
s->sent_y->minimum(s->sent_re_plot_min);
|
||||
}
|
||||
sent_re = new Ca_Line(500, sent_re_plot, 0, 0, FL_BLUE, CA_NO_POINT);
|
||||
s->sent_re = new Ca_Line(500, s->sent_re_plot, 0, 0, FL_BLUE, CA_NO_POINT);
|
||||
|
||||
if (seq_no > highest_seq_no_seen)
|
||||
highest_seq_no_seen = seq_no;
|
||||
if (seq_no > s->highest_seq_no_seen)
|
||||
s->highest_seq_no_seen = seq_no;
|
||||
|
||||
if (++skip >= 100)
|
||||
{
|
||||
@@ -159,116 +162,118 @@ int start_media_monitor(void)
|
||||
|
||||
len = 128;
|
||||
|
||||
w = new Fl_Double_Window(465, 400, "IP streaming media monitor");
|
||||
s->w = new Fl_Double_Window(465, 400, "IP streaming media monitor");
|
||||
|
||||
c_right = new Fl_Group(0, 0, 465, 405);
|
||||
s->c_right = new Fl_Group(0, 0, 465, 405);
|
||||
|
||||
c_sent = new Fl_Group(0, 0, 465, 200);
|
||||
c_sent->box(FL_DOWN_BOX);
|
||||
c_sent->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE);
|
||||
c_sent->current();
|
||||
s->c_sent = new Fl_Group(0, 0, 465, 200);
|
||||
s->c_sent->box(FL_DOWN_BOX);
|
||||
s->c_sent->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE);
|
||||
s->c_sent->current();
|
||||
|
||||
canvas_sent = new Ca_Canvas(110, 35, 300, 100, "Packet delays");
|
||||
canvas_sent->box(FL_PLASTIC_DOWN_BOX);
|
||||
canvas_sent->color(7);
|
||||
canvas_sent->align(FL_ALIGN_TOP);
|
||||
Fl_Group::current()->resizable(canvas_sent);
|
||||
canvas_sent->border(15);
|
||||
s->canvas_sent = new Ca_Canvas(110, 35, 300, 100, "Packet delays");
|
||||
s->canvas_sent->box(FL_PLASTIC_DOWN_BOX);
|
||||
s->canvas_sent->color(7);
|
||||
s->canvas_sent->align(FL_ALIGN_TOP);
|
||||
Fl_Group::current()->resizable(s->canvas_sent);
|
||||
s->canvas_sent->border(15);
|
||||
|
||||
sent_x = new Ca_X_Axis(115, 135, 290, 30, "Packet");
|
||||
sent_x->align(FL_ALIGN_BOTTOM);
|
||||
sent_x->minimum(0.0);
|
||||
sent_x->maximum(500.0);
|
||||
sent_x->label_format("%g");
|
||||
sent_x->minor_grid_color(fl_gray_ramp(20));
|
||||
sent_x->major_grid_color(fl_gray_ramp(15));
|
||||
sent_x->label_grid_color(fl_gray_ramp(10));
|
||||
sent_x->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
|
||||
sent_x->minor_grid_style(FL_DOT);
|
||||
sent_x->major_step(5);
|
||||
sent_x->label_step(1);
|
||||
sent_x->axis_align(CA_BOTTOM | CA_LINE);
|
||||
sent_x->axis_color(FL_BLACK);
|
||||
sent_x->current();
|
||||
s->sent_x = new Ca_X_Axis(115, 135, 290, 30, "Packet");
|
||||
s->sent_x->align(FL_ALIGN_BOTTOM);
|
||||
s->sent_x->minimum(0.0);
|
||||
s->sent_x->maximum(500.0);
|
||||
s->sent_x->label_format("%g");
|
||||
s->sent_x->minor_grid_color(fl_gray_ramp(20));
|
||||
s->sent_x->major_grid_color(fl_gray_ramp(15));
|
||||
s->sent_x->label_grid_color(fl_gray_ramp(10));
|
||||
s->sent_x->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
|
||||
s->sent_x->minor_grid_style(FL_DOT);
|
||||
s->sent_x->major_step(5);
|
||||
s->sent_x->label_step(1);
|
||||
s->sent_x->axis_align(CA_BOTTOM | CA_LINE);
|
||||
s->sent_x->axis_color(FL_BLACK);
|
||||
s->sent_x->current();
|
||||
|
||||
sent_y = new Ca_Y_Axis(60, 40, 50, 90, "Delay\n(ms)");
|
||||
sent_y->align(FL_ALIGN_LEFT);
|
||||
sent_y->minimum(0.0);
|
||||
sent_y->maximum(2000.0);
|
||||
sent_y->minor_grid_color(fl_gray_ramp(20));
|
||||
sent_y->major_grid_color(fl_gray_ramp(15));
|
||||
sent_y->label_grid_color(fl_gray_ramp(10));
|
||||
sent_y->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
|
||||
sent_y->minor_grid_style(FL_DOT);
|
||||
sent_y->major_step(5);
|
||||
sent_y->label_step(1);
|
||||
sent_y->axis_color(FL_BLACK);
|
||||
sent_y->current();
|
||||
s->sent_y = new Ca_Y_Axis(60, 40, 50, 90, "Delay\n(ms)");
|
||||
s->sent_y->align(FL_ALIGN_LEFT);
|
||||
s->sent_y->minimum(0.0);
|
||||
s->sent_y->maximum(2000.0);
|
||||
s->sent_y->minor_grid_color(fl_gray_ramp(20));
|
||||
s->sent_y->major_grid_color(fl_gray_ramp(15));
|
||||
s->sent_y->label_grid_color(fl_gray_ramp(10));
|
||||
s->sent_y->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
|
||||
s->sent_y->minor_grid_style(FL_DOT);
|
||||
s->sent_y->major_step(5);
|
||||
s->sent_y->label_step(1);
|
||||
s->sent_y->axis_color(FL_BLACK);
|
||||
s->sent_y->current();
|
||||
|
||||
c_sent->end();
|
||||
s->c_sent->end();
|
||||
|
||||
c_received = new Fl_Group(0, 200, 465, 200);
|
||||
c_received->box(FL_DOWN_BOX);
|
||||
c_received->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE);
|
||||
c_received->current();
|
||||
s->c_received = new Fl_Group(0, 200, 465, 200);
|
||||
s->c_received->box(FL_DOWN_BOX);
|
||||
s->c_received->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE);
|
||||
s->c_received->current();
|
||||
|
||||
canvas_received = new Ca_Canvas(110, 235, 300, 100, "Delay spread");
|
||||
canvas_received->box(FL_PLASTIC_DOWN_BOX);
|
||||
canvas_received->color(7);
|
||||
canvas_received->align(FL_ALIGN_TOP);
|
||||
Fl_Group::current()->resizable(canvas_received);
|
||||
canvas_received->border(15);
|
||||
s->canvas_received = new Ca_Canvas(110, 235, 300, 100, "Delay spread");
|
||||
s->canvas_received->box(FL_PLASTIC_DOWN_BOX);
|
||||
s->canvas_received->color(7);
|
||||
s->canvas_received->align(FL_ALIGN_TOP);
|
||||
Fl_Group::current()->resizable(s->canvas_received);
|
||||
s->canvas_received->border(15);
|
||||
|
||||
received_x = new Ca_X_Axis(115, 335, 290, 30, "Delay (ms)");
|
||||
received_x->align(FL_ALIGN_BOTTOM);
|
||||
received_x->minimum(0.0);
|
||||
received_x->maximum(2000.0);
|
||||
received_x->label_format("%g");
|
||||
received_x->minor_grid_color(fl_gray_ramp(20));
|
||||
received_x->major_grid_color(fl_gray_ramp(15));
|
||||
received_x->label_grid_color(fl_gray_ramp(10));
|
||||
received_x->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
|
||||
received_x->minor_grid_style(FL_DOT);
|
||||
received_x->major_step(5);
|
||||
received_x->label_step(1);
|
||||
received_x->axis_align(CA_BOTTOM | CA_LINE);
|
||||
received_x->axis_color(FL_BLACK);
|
||||
received_x->current();
|
||||
s->received_x = new Ca_X_Axis(115, 335, 290, 30, "Delay (ms)");
|
||||
s->received_x->align(FL_ALIGN_BOTTOM);
|
||||
s->received_x->minimum(0.0);
|
||||
s->received_x->maximum(2000.0);
|
||||
s->received_x->label_format("%g");
|
||||
s->received_x->minor_grid_color(fl_gray_ramp(20));
|
||||
s->received_x->major_grid_color(fl_gray_ramp(15));
|
||||
s->received_x->label_grid_color(fl_gray_ramp(10));
|
||||
s->received_x->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
|
||||
s->received_x->minor_grid_style(FL_DOT);
|
||||
s->received_x->major_step(5);
|
||||
s->received_x->label_step(1);
|
||||
s->received_x->axis_align(CA_BOTTOM | CA_LINE);
|
||||
s->received_x->axis_color(FL_BLACK);
|
||||
s->received_x->current();
|
||||
|
||||
received_y = new Ca_Y_Axis(60, 240, 50, 90, "Freq");
|
||||
received_y->align(FL_ALIGN_LEFT);
|
||||
received_y->minimum(0.0);
|
||||
received_y->maximum(50.0);
|
||||
received_y->minor_grid_color(fl_gray_ramp(20));
|
||||
received_y->major_grid_color(fl_gray_ramp(15));
|
||||
received_y->label_grid_color(fl_gray_ramp(10));
|
||||
received_y->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
|
||||
received_y->minor_grid_style(FL_DOT);
|
||||
received_y->major_step(5);
|
||||
received_y->label_step(1);
|
||||
received_y->axis_color(FL_BLACK);
|
||||
received_y->current();
|
||||
s->received_y = new Ca_Y_Axis(60, 240, 50, 90, "Freq");
|
||||
s->received_y->align(FL_ALIGN_LEFT);
|
||||
s->received_y->minimum(0.0);
|
||||
s->received_y->maximum(50.0);
|
||||
s->received_y->minor_grid_color(fl_gray_ramp(20));
|
||||
s->received_y->major_grid_color(fl_gray_ramp(15));
|
||||
s->received_y->label_grid_color(fl_gray_ramp(10));
|
||||
s->received_y->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
|
||||
s->received_y->minor_grid_style(FL_DOT);
|
||||
s->received_y->major_step(5);
|
||||
s->received_y->label_step(1);
|
||||
s->received_y->axis_color(FL_BLACK);
|
||||
s->received_y->current();
|
||||
|
||||
for (i = 0; i < 2000; i++)
|
||||
received_delays_plot[2*i] = i;
|
||||
received_delays_plot_max = 0.0;
|
||||
min_diff = 2000;
|
||||
max_diff = 0;
|
||||
s->received_delays_plot[2*i] = i;
|
||||
s->received_delays_plot_max = 0.0;
|
||||
s->min_diff = 2000;
|
||||
s->max_diff = 0;
|
||||
|
||||
s->received_delays = NULL;
|
||||
s->highest_seq_no_seen = -1;
|
||||
|
||||
for (i = 0; i < 500; i++)
|
||||
sent_re_plot[2*i] = i;
|
||||
sent_re_plot_min = 99999.0;
|
||||
sent_re_plot_max = 0.0;
|
||||
s->sent_re_plot[2*i] = i;
|
||||
s->sent_re_plot_min = 99999.0;
|
||||
s->sent_re_plot_max = 0.0;
|
||||
s->sent_re = NULL;
|
||||
|
||||
c_received->end();
|
||||
s->c_received->end();
|
||||
|
||||
c_right->end();
|
||||
s->c_right->end();
|
||||
|
||||
Fl_Group::current()->resizable(c_right);
|
||||
w->end();
|
||||
w->show();
|
||||
|
||||
in_ptr = 0;
|
||||
Fl_Group::current()->resizable(s->c_right);
|
||||
s->w->end();
|
||||
s->w->show();
|
||||
|
||||
Fl::check();
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user