From c7f56462490eb287a4152fb086dc8ae4ef8fcd11 Mon Sep 17 00:00:00 2001 From: Jirka Novak Date: Tue, 13 Apr 2021 16:38:13 +0200 Subject: VoIP dialogs: Performance improvements Retap and UI response are much faster when many RTP streams are processed. RTP Streams/Analyse 1000+, RTP Player 500+. Changes: - RTP streams are searched with hash, not by iterating over list. - UI operations do not redraw screen after every change, just after all changes. UI is locked when rereading packets. - Sample list during RTP decoding is stored in memory so wireshark uses just half of opened files for audio decoding than before. - Analysis window checkbox area is limited in height - Dialogs shows shows count of streams, count of selected streams and count of unmuted streams - Documentation extended with chapter about RTP decoding parameters - Documentation extended with performance estimates --- ui/qt/rtp_analysis_dialog.cpp | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) (limited to 'ui/qt/rtp_analysis_dialog.cpp') diff --git a/ui/qt/rtp_analysis_dialog.cpp b/ui/qt/rtp_analysis_dialog.cpp index c57d508f98..632f0e2bef 100644 --- a/ui/qt/rtp_analysis_dialog.cpp +++ b/ui/qt/rtp_analysis_dialog.cpp @@ -429,7 +429,7 @@ int RtpAnalysisDialog::addTabUI(tab_info_t *new_tab) new_tab->graphHorizontalLayout->setStretch(6, 1); - ui->verticalLayout_2->addLayout(new_tab->graphHorizontalLayout); + ui->layout->addLayout(new_tab->graphHorizontalLayout); return new_tab_no; } @@ -504,6 +504,7 @@ void RtpAnalysisDialog::updateWidgets() ui->actionNextProblem->setEnabled(enable_nav); if (enable_nav) { + hint.append(tr(" %1 streams, ").arg(tabs_.count() - 1)); hint.append(tr(" G: Go to packet, N: Next problem packet")); } @@ -653,10 +654,13 @@ tap_packet_status RtpAnalysisDialog::tapPacket(void *tapinfo_ptr, packet_info *p return TAP_PACKET_DONT_REDRAW; /* is it the forward direction? */ else { - for(int i=0; itabs_.count(); i++) { - tab_info_t *tab = rtp_analysis_dialog->tabs_[i]; - if (rtpstream_id_equal_pinfo_rtp_info(&(tab->stream.id),pinfo,rtpinfo)) { + // Search tab in hash key, if there are multiple tabs with same hash + QList tabs = rtp_analysis_dialog->tab_hash_.values(pinfo_rtp_info_to_hash(pinfo, rtpinfo)); + for (int i = 0; i < tabs.size(); i++) { + tab_info_t *tab = tabs.at(i); + if (rtpstream_id_equal_pinfo_rtp_info(&tab->stream.id, pinfo, rtpinfo)) { rtp_analysis_dialog->addPacket(tab, pinfo, rtpinfo); + break; } } } @@ -930,6 +934,7 @@ void RtpAnalysisDialog::closeTab(int index) if (index != tabs_.count()) { QWidget *remove_tab = qobject_cast(ui->tabWidget->widget(index)); tab_info_t *tab = tabs_[index]; + tab_hash_.remove(rtpstream_to_hash(&tab->stream), tab); ui->tabWidget->removeTab(index); ui->streamGraph->removeGraph(tab->jitter_graph); ui->streamGraph->removeGraph(tab->diff_graph); @@ -1089,11 +1094,16 @@ void RtpAnalysisDialog::addRtpStreamsPrivate(QVector stream_ { int first_tab_no = -1; + setUpdatesEnabled(false); foreach(rtpstream_info_t *rtpstream, stream_infos) { bool found = false; - for(int i=0; i < tabs_.count(); i++) { - if (rtpstream_id_equal(&(tabs_[i]->stream.id), &(rtpstream->id), RTPSTREAM_ID_EQUAL_SSRC)) { + + QList tabs = tab_hash_.values(rtpstream_to_hash(rtpstream)); + for (int i = 0; i < tabs.size(); i++) { + tab_info_t *tab = tabs.at(i); + if (rtpstream_id_equal(&tab->stream.id, &rtpstream->id, RTPSTREAM_ID_EQUAL_SSRC)) { found = true; + break; } } @@ -1108,6 +1118,7 @@ void RtpAnalysisDialog::addRtpStreamsPrivate(QVector stream_ new_tab->delta_vals = new QVector(); tabs_ << new_tab; cur_tab_no = addTabUI(new_tab); + tab_hash_.insert(rtpstream_to_hash(rtpstream), new_tab); if (first_tab_no == -1) { first_tab_no = cur_tab_no; } @@ -1116,6 +1127,7 @@ void RtpAnalysisDialog::addRtpStreamsPrivate(QVector stream_ if (first_tab_no != -1) { ui->tabWidget->setCurrentIndex(first_tab_no); } + setUpdatesEnabled(true); registerTapListener("rtp", this, NULL, 0, tapReset, tapPacket, tapDraw); cap_file_.retapPackets(); removeTapListeners(); @@ -1125,13 +1137,17 @@ void RtpAnalysisDialog::addRtpStreamsPrivate(QVector stream_ void RtpAnalysisDialog::removeRtpStreams(QVector stream_infos _U_) { + setUpdatesEnabled(false); foreach(rtpstream_info_t *rtpstream, stream_infos) { - for(int i=0; i < tabs_.count(); i++) { - if (rtpstream_id_equal(&(tabs_[i]->stream.id), &(rtpstream->id), RTPSTREAM_ID_EQUAL_SSRC)) { - closeTab(i); + QList tabs = tab_hash_.values(rtpstream_to_hash(rtpstream)); + for (int i = 0; i < tabs.size(); i++) { + tab_info_t *tab = tabs.at(i); + if (rtpstream_id_equal(&tab->stream.id, &rtpstream->id, RTPSTREAM_ID_EQUAL_SSRC)) { + closeTab(tabs_.indexOf(tab)); } } } + setUpdatesEnabled(true); updateGraph(); } -- cgit v1.2.3