From 8682eb49ef9e865be114ac57525628527bad1bd6 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Tue, 20 Oct 2015 08:31:52 -0700 Subject: Split RTP player tapping, decoding, and plotting. In RtpAudioStream split tapping+decoding into separate member functions. Store RTP payloads in memory. In RtpPlayerDialog split tapping+plotting. This more closely resembles what we're doing in the GTK+ UI and paves the way for jitter support and other changes. Change-Id: I244c225cec8930545622e6582b7be35ebe45b237 Reviewed-on: https://code.wireshark.org/review/11195 Petri-Dish: Gerald Combs Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs --- ui/qt/rtp_player_dialog.cpp | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'ui/qt/rtp_player_dialog.cpp') diff --git a/ui/qt/rtp_player_dialog.cpp b/ui/qt/rtp_player_dialog.cpp index 6a46d4b240..f25668f486 100644 --- a/ui/qt/rtp_player_dialog.cpp +++ b/ui/qt/rtp_player_dialog.cpp @@ -177,7 +177,16 @@ RtpPlayerDialog::~RtpPlayerDialog() delete ui; } -void RtpPlayerDialog::retapPackets(bool rescale_axes) +void RtpPlayerDialog::retapPackets() +{ + register_tap_listener("rtp", this, NULL, 0, NULL, tapPacket, NULL); + cap_file_.retapPackets(); + remove_tap_listener(this); + + rescanPackets(); +} + +void RtpPlayerDialog::rescanPackets(bool rescale_axes) { int row_count = ui->streamTreeWidget->topLevelItemCount(); // Clear existing graphs and reset stream values @@ -190,10 +199,6 @@ void RtpPlayerDialog::retapPackets(bool rescale_axes) } ui->audioPlot->clearGraphs(); - register_tap_listener("rtp", this, NULL, 0, NULL, tapPacket, NULL); - cap_file_.retapPackets(); - remove_tap_listener(this); - bool show_legend = false; bool relative_timestamps = !ui->todCheckBox->isChecked(); @@ -204,6 +209,8 @@ void RtpPlayerDialog::retapPackets(bool rescale_axes) RtpAudioStream *audio_stream = ti->data(stream_data_col_, Qt::UserRole).value(); int y_offset = row_count - row - 1; + audio_stream->decode(); + // Waveform QCPGraph *audio_graph = ui->audioPlot->addGraph(); QPen wf_pen(audio_stream->color()); @@ -215,7 +222,7 @@ void RtpPlayerDialog::retapPackets(bool rescale_axes) audio_graph->setData(audio_stream->visualTimestamps(relative_timestamps), audio_stream->visualSamples(y_offset)); audio_graph->removeFromLegend(); ti->setData(graph_data_col_, Qt::UserRole, QVariant::fromValue(audio_graph)); - // RTP_STREAM_DEBUG("Plotting %s, %d samples", ti->text(src_addr_col_).toUtf8().constData(), audio_graph->data()->keys().length()); + RTP_STREAM_DEBUG("Plotting %s, %d samples", ti->text(src_addr_col_).toUtf8().constData(), audio_graph->data()->keys().length()); QString span_str = QString("%1 - %2 (%3)") .arg(QString::number(audio_stream->startRelTime(), 'g', 3)) @@ -303,7 +310,11 @@ void RtpPlayerDialog::addRtpStream(struct _rtp_stream_info *rtp_stream) } else { start_rel_time_ = qMin(start_rel_time_, start_rel_time); } - // RTP_STREAM_DEBUG("adding stream %s to layout, %u packets, start %u", stream_key.toUtf8().constData(), rtp_stream->packet_count, rtp_stream->start_fd->num); + RTP_STREAM_DEBUG("adding stream %d to layout, %u packets, %u in list, start %u", + ui->streamTreeWidget->topLevelItemCount(), + rtp_stream->packet_count, + g_list_length(rtp_stream->rtp_packet_list), + rtp_stream->start_fd->num); } void RtpPlayerDialog::showEvent(QShowEvent *) @@ -618,7 +629,7 @@ void RtpPlayerDialog::on_todCheckBox_toggled(bool) QCPAxis *x_axis = ui->audioPlot->xAxis; double old_lowest = getLowestTimestamp(); - retapPackets(false); + rescanPackets(false); x_axis->moveRange(getLowestTimestamp() - old_lowest); ui->audioPlot->replot(); } -- cgit v1.2.1