diff options
author | Dario Lombardo <lomato@gmail.com> | 2015-09-04 17:12:25 +0200 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-09-09 17:53:08 +0000 |
commit | ecc62d8706ad4ed7768cde31dcd4476b4d2389a9 (patch) | |
tree | b1fc6ad1945a8749383118623d88ac1dcef3feed /ui | |
parent | 8a8a82d1b672ebefdc65ea1f316b725fabe47954 (diff) |
codecs/gtk: fix int to size_t
Change-Id: I8f467f09375c8227c4b70aef47ff3a590a0c00d7
Reviewed-on: https://code.wireshark.org/review/10413
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/gtk/rtp_player.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/ui/gtk/rtp_player.c b/ui/gtk/rtp_player.c index 9dc9767846..50bbf70fbe 100644 --- a/ui/gtk/rtp_player.c +++ b/ui/gtk/rtp_player.c @@ -55,6 +55,7 @@ #include <math.h> #include <string.h> #include <portaudio.h> +#include <assert.h> #include <gtk/gtk.h> @@ -119,11 +120,11 @@ static int new_jitter_buff; /* a hash table with the RTP streams to play per audio channel */ static GHashTable *rtp_channels_hash = NULL; -static int sample_rate = 8000; -static int channels = 1; +static unsigned sample_rate = 8000; +static unsigned channels = 1; /* Port Audio stuff */ -static int output_channels = 2; +static unsigned output_channels = 2; #define PA_SAMPLE_TYPE paInt16 typedef gint16 SAMPLE; @@ -456,15 +457,15 @@ mark_all_rtp_stream_to_decode(gchar *key _U_ , rtp_stream_info_t *rsi, gpointer /* Decode a RTP packet * Return the number of decoded bytes */ -static int +static size_t decode_rtp_packet(rtp_packet_t *rp, SAMPLE **out_buff, GHashTable *decoders_hash) { unsigned int payload_type; const gchar *p; rtp_decoder_t *decoder; SAMPLE *tmp_buff = NULL; - int tmp_buff_len; - int decoded_bytes = 0; + size_t tmp_buff_len; + size_t decoded_bytes = 0; if ((rp->payload_data == NULL) || (rp->info->info_payload_len == 0) ) { return 0; @@ -533,7 +534,8 @@ decode_rtp_stream(rtp_stream_info_t *rsi, gpointer ptr) GList* rtp_packet_list; rtp_packet_t *rp; - int i; + size_t i; + gint32 j; double rtp_time; double rtp_time_prev; double arrive_time; @@ -551,8 +553,8 @@ decode_rtp_stream(rtp_stream_info_t *rsi, gpointer ptr) #endif char *src_addr, *dst_addr; - int decoded_bytes; - int decoded_bytes_prev; + size_t decoded_bytes; + size_t decoded_bytes_prev; int jitter_buff; SAMPLE *out_buff = NULL; sample_t silence; @@ -611,7 +613,7 @@ decode_rtp_stream(rtp_stream_info_t *rsi, gpointer ptr) } else { /* Add silence between the two streams if needed */ silence_frames = (gint32)((nstime_to_msec(&rsi->start_fd->abs_ts) - nstime_to_msec(&rci->stop_time_abs)) * sample_rate); - for (i = 0; i< silence_frames; i++) { + for (j = 0; j < silence_frames; j++) { g_array_append_val(rci->samples, silence); } rci->num_packets += rsi->packet_count; @@ -720,7 +722,7 @@ decode_rtp_stream(rtp_stream_info_t *rsi, gpointer ptr) if (silence_frames > MAX_SILENCE_FRAMES) silence_frames = MAX_SILENCE_FRAMES; - for (i = 0; i< silence_frames; i++) { + for (j = 0; j < silence_frames; j++) { silence.status = status; g_array_append_val(rci->samples, silence); @@ -756,7 +758,7 @@ decode_rtp_stream(rtp_stream_info_t *rsi, gpointer ptr) if (silence_frames > MAX_SILENCE_FRAMES) silence_frames = MAX_SILENCE_FRAMES; - for (i = 0; i< silence_frames; i++) { + for (j = 0; j < silence_frames; j++) { silence.status = status; g_array_append_val(rci->samples, silence); @@ -1888,6 +1890,7 @@ play_channels(void) /* if not PAUSE, then start to PLAY */ } else { #if PORTAUDIO_API_1 + assert(output_channels <= INT_MAX); err = Pa_OpenStream( &pa_stream, paNoDevice, /* default input device */ @@ -1895,7 +1898,7 @@ play_channels(void) PA_SAMPLE_TYPE, NULL, Pa_GetDefaultOutputDeviceID(), - output_channels, + (int)output_channels, PA_SAMPLE_TYPE, NULL, sample_rate, @@ -1935,10 +1938,11 @@ play_channels(void) } #else /* PORTAUDIO_API_1 */ if (Pa_GetDefaultOutputDevice() != paNoDevice) { + assert(output_channels <= INT_MAX); err = Pa_OpenDefaultStream( &pa_stream, 0, - output_channels, + (int)output_channels, PA_SAMPLE_TYPE, sample_rate, FRAMES_PER_BUFFER, |