Qt: fix jitter buffer management

Small bugs were introduced when copy/pasting the code from GTK UI:
- arrive_offset is stored in seconds and not milliseconds
- some tests regarding the current playback mode were wrong

Change-Id: I21fb82ba8ff6c8defa7df90c815c040e9e074aaa
Reviewed-on: https://code.wireshark.org/review/13885
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
This commit is contained in:
Pascal Quantin 2016-02-10 15:01:02 +01:00
parent dae11790e7
commit 8186ab3d9f
2 changed files with 5 additions and 5 deletions

View File

@ -250,14 +250,14 @@ void RtpAudioStream::decode()
double rtp_time = (double)(rtp_packet->info->info_timestamp-start_timestamp)/sample_rate - start_rtp_time;
double arrive_time;
if (timing_mode_ == Uninterrupted) {
if (timing_mode_ == RtpTimestamp) {
arrive_time = rtp_time;
} else {
arrive_time = (double)rtp_packet->arrive_offset/1000 - start_time;
arrive_time = rtp_packet->arrive_offset - start_time;
}
double diff = qAbs(arrive_time - rtp_time);
if (diff*1000 > jitter_buffer_size_ && timing_mode_ == Uninterrupted) {
if (diff*1000 > jitter_buffer_size_ && timing_mode_ != Uninterrupted) {
// rtp_player.c:628
jitter_drop_timestamps_.append(stop_rel_time_);
@ -281,7 +281,7 @@ void RtpAudioStream::decode()
/* XXX: if timestamps (RTP) are missing/ignored try use packet arrive time only (see also "rtp_time") */
start_timestamp = rtp_packet->info->info_timestamp;
start_rtp_time = 0;
start_time = (double)rtp_packet->arrive_offset/1000;
start_time = rtp_packet->arrive_offset;
rtp_time_prev = 0;
}

View File

@ -50,7 +50,7 @@ typedef gint16 SAMPLE;
typedef struct _rtp_packet {
guint32 frame_num; /* Qt only */
struct _rtp_info *info; /* the RTP dissected info */
double arrive_offset; /* arrive offset time since the beginning of the stream in ms */
double arrive_offset; /* arrive offset time since the beginning of the stream as ms in GTK UI and s in Qt UI */
guint8* payload_data;
} rtp_packet_t;