Commit Graph

34 Commits

Author SHA1 Message Date
Jiri Novak 27a1906c58 RTP: Code clean up
Changes:
- rtpstream_packet renamed to rtpstream_packet_cb to follow *_cb pattern
- variables/types used in iax2_analysis_dialog were created as copy of *rtp* ones, but names were left as *rtp* -> *iax2*
- struct _rtp_stream_info replaced with rtp_stream_info_t
- there was tap-rtp-analysis.h, but no tap-rtp-analysis.c - related content was moved from tap-rtp-common.c
- *rtp_stream* functions renamed to *rtpstream*
- renamed rtp_stream_info_t to rtpstream_info_t to follow *rtpstream* pattern.
- renamed ui/rtp_stream.c rtpstream_draw -> rtpstream_draw_cb

Change-Id: Ib11ff5367cc464ea1b0c73432bc50b0eb9cd203e
Reviewed-on: https://code.wireshark.org/review/28299
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-06-19 15:05:12 +00:00
Stig Bjørlykke 14720ace06 Fix comment end after SPDX identifier
Move */ to a separate line below the SPDX identifier.

Change-Id: Id1032215449cfccae0933147b45e04b65e0b727f
Reviewed-on: https://code.wireshark.org/review/27211
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-01 06:56:37 +00:00
Dario Lombardo 8cd389e161 replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later.
The first is deprecated, as per https://spdx.org/licenses/.

Change-Id: I8e21e1d32d09b8b94b93a2dc9fbdde5ffeba6bed
Reviewed-on: https://code.wireshark.org/review/25661
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-08 14:57:36 +00:00
Dario Lombardo e52172c775 Qt: use SPDX identifiers.
Change-Id: I111945c08f99818c249a868c12d9a7b3a3df64b3
Reviewed-on: https://code.wireshark.org/review/25563
Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-02-02 13:39:36 +00:00
Gerald Combs 28dce11948 Qt RTP: Add the default device and adjust sample rates.
In the RTP player dialog, list the default audio device first, ensure
it's selected by default and ensure that the list items are unique.
According to

http://code.qt.io/cgit/qt/qtmultimedia.git/tree/src/plugins/windowsaudio/qwindowsaudiodeviceinfo.cpp?h=5.9

the default device on Windows uses the special WAVE_MAPPER id, which
appears to support various sample rates even when the underlying
hardware doesn't.

Ensuring the names are unique fixes an issue I'm seeing on a test
machine here.

When decoding, check to see if our sample rate is supported by our
output device and adjust accordingly.

Bug: 13906
Change-Id: Iddc0beb2459bfac42276ff29d227c2619b0a8d90
Reviewed-on: https://code.wireshark.org/review/22756
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2017-07-21 21:09:26 +00:00
Guy Harris 357cfd3b03 A bunch of "{Mac} OS X" -> "macOS" changes.
Avoid anachronisms, however; there was no "macOS 10.0" or even "OS X
10.0", for example.  It was "Mac OS X" until 10.8 (although 10.7 was
sometimes called "OS X" and sometimes called "Mac OS X"), and it was "OS
X" from 10.8 to 10.11.

Change-Id: Ie4a848997dcc6c45c2245c1fb84ec526032375c3
Reviewed-on: https://code.wireshark.org/review/20933
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-04-05 19:16:22 +00:00
Peter Wu 6e29d874f8 Qt: fix crash on undecodable RTP stream
When the sample rate is zero, a floating point exception (FPE) occurs in
QAudioDeviceInfo::nearestFormat. Detect the error condition instead and
show an error.

Change-Id: Ie2eaa57847938fe15607fa26d0f4e08e7ddd23d1
Fixes: v2.3.0rc0-1664-gd59653f8d5 ("Qt: Make the RTP player output device selectable.")
Reviewed-on: https://code.wireshark.org/review/19569
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-08 02:48:41 +00:00
Guy Harris c65e5851b2 Make some items that don't need to be size_t guint.
Those sizes are limited by the packet sizes we support, and we only
support a maximum packet size of 2^32.

This squelches some compiler warnings.

Remove some casts that this renders unnecessary.

Change-Id: Id9a7bcf8c2ce30bbed7be6c0e28deb9cf38002e0
Reviewed-on: https://code.wireshark.org/review/19279
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-12-15 11:52:49 +00:00
Gerald Combs d59653f8d5 Qt: Make the RTP player output device selectable.
Add a combobox for selecting the output device and populate it with our
available devices. Let the user know if our output format isn't
supported.

Ping-Bug: 13105
Change-Id: I299c7d0f191bb66d93896338036000e2c377781f
Reviewed-on: https://code.wireshark.org/review/19046
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-12-06 22:36:55 +00:00
Peter Wu f5e22a1487 codecs: Add support for G.722 and G.726
Integrate the Spandsp library for G.722 and G.726 support. Adds support
for G.722 and all eight variants of G.726.

Note: this also fixes a crash in Qt (buffer overrun, reading too much
data) caused by confusion of the larger output buffer (resample_buff)
with the smaller input buffer (decode_buff). It was not triggered before
because the sample rate was always 8k, but with the addition of the new
codecs, a different sample rate became possible (16k).

Fix also a crash which occurs when the RTP_STREAM_DEBUG macro is enabled
and the VOIP Calls dialog is opened (the begin frame, start_fd, is not
yet known and therfore a NULL dereference could occur).

Passes testing (plays normally without bad RTP timing errors) with
SampleCaptures files: sip-rtp-g722.pcap and sip-rtp-g726.pcap. Tested
with cmake (Qt), autotools (Qt and GTK+) with ASAN enabled.

Bug: 5619
Change-Id: I5661908d193927bba50901079119eeff0c04991f
Reviewed-on: https://code.wireshark.org/review/18939
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-12-06 17:51:47 +00:00
Peter Wu 9887cd7feb Qt: fix crash when closing RTP player while playing
For some time, the RTP Player has been crashing for me (Arch Linux, Qt
5.7.0) when the RTP Player is active (affects also Wireshark 2.0.5).

This call trace was observed:

    + RtpPlayerDialog::reject (closing dialog via Escape / Close button)
      + RtpAudioStream::stopPlaying
        + RtpAudioStream::outputStateChanged(QAudio::StoppedState)
          + QAudioOutput::deleteLater   // problematic!
      + RtpPlayerDialog::~RtpPlayerDialog
        + RtpAudioStream::~RtpAudioStream

As the QAudioOutput instance is a child of RtpAudioStream, it is also
destroyed after that. QAudioOutput's destructor somehow invokes (via
libqtmedia_pulse.so) a main loop iteration which invokes the previously
scheduled deleteLater call.

As QAudioOutput was already being destructed, this results in a crash.
Workaround this by removing this child from RtpAudioStream (no cruelty
intended).

Change-Id: I88f2e929ac566534be5d2270e2e0b194685533eb
Reviewed-on: https://code.wireshark.org/review/18970
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-11-30 19:52:55 +00:00
Jeff Morriss fea6e738bb RTP player: increase the maximum number of silence frames to 30 minutes worth.
The BadAlloc X11 crash I reported in bug 4119 (which is why the limit was as
low as it was) has long since been fixed thanks to
bug 2630/I71e1bd2f9a62792db06ce887e2bbe7a96d110e0a so we can now deal with
more silence frames.

Change-Id: I0127381e71e497560e0f23af04f9d96af1ed6335
Ping-Bug: 5902
Ping-Bug: 4119
Ping-Bug: 2270
Reviewed-on: https://code.wireshark.org/review/16003
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-06-23 03:30:39 +00:00
Gerald Combs 0ec5a271ea Qt: RTP audio stream fixups.
Make sure audio_stream_ is non-NULL before we try to use it. Delete
audio_stream_ more gracefully and add a note about mutexes on OS X and
Windows.

Bug: 12166
Change-Id: I12e76c49e631bc1de813c5c7d82c7d928c71237e
Reviewed-on: https://code.wireshark.org/review/15759
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-06-06 23:37:01 +00:00
João Valverde 9f8fc21b62 autotools: Check for SpeexDSP system library
Change-Id: Ie07f49ec5a563f3b43a2442e05646c6a0b51ca41
Reviewed-on: https://code.wireshark.org/review/15349
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2016-05-16 14:16:41 +00:00
João Valverde 8c95f96599 Qt: Use SpeexDSP API names for RTP player
The speex headers use some CPP magic to rename the API.

Using the public names in the calling code reduces obfuscation and
allows linking with libspeexdsp.so also.

Change-Id: I10c6cd2de6b237400224d3db6a9995e646747311
Reviewed-on: https://code.wireshark.org/review/15400
Petri-Dish: João Valverde <j@v6e.pt>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2016-05-14 04:46:01 +00:00
Pascal Quantin 8186ab3d9f 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>
2016-02-10 20:26:21 +00:00
Guy Harris bc5a0374bf Add the packet number to the packet_info structure, and use it.
That removes most of the uses of the frame number field in the
frame_data structure.

Change-Id: Ie22e4533e87f8360d7c0a61ca6ffb796cc233f22
Reviewed-on: https://code.wireshark.org/review/13509
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-24 03:41:28 +00:00
Stig Bjørlykke 720f57d000 ui: Code cleanup
Fixed code layout to use common style in the file.
Mostly whitespace changes.

Change-Id: Id37b57717a9e26248fad07322dff09b1d1f45ac2
Reviewed-on: https://code.wireshark.org/review/13504
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-01-23 23:15:54 +00:00
Guy Harris a7f470fa24 More pinfo->fd->abs_ts to pinfo->abs_ts.
Change-Id: I70db0a345cc4c5c57c454371deb4f92f9ac4b9ac
Reviewed-on: https://code.wireshark.org/review/13501
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-23 03:58:56 +00:00
Pascal Quantin 2e4be481b8 Qt: fix a potential memory leak in RTP audio stream playback
Change-Id: I6847f85d56841f99594063bfb7441d0c40e452a7
Reviewed-on: https://code.wireshark.org/review/12425
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-12-04 10:53:19 +00:00
Pascal Quantin 46370b3aea Qt: write number of decoded bytes in the RTP player temporary buffer
For codecs using compression (so not G.711) the number of decoded bytes is different from payload len * sample bytes.
This result in a truncated audio buffer and inaudible audio.

Change-Id: I755c19df37820c1c56acc7bd7b67fcc104516474
Reviewed-on: https://code.wireshark.org/review/12336
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-12-01 21:24:42 +00:00
Pascal Quantin 7e18954a27 Qt: fix generation of silence samples
The current code generates a shrill noise at least on Windows.
Presumably memccpy does not behave as initially expected :)

Change-Id: Id23a35d1d41ef4044b6a96c093a8fa927828f8b3
Reviewed-on: https://code.wireshark.org/review/12337
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-12-01 21:19:25 +00:00
Peter Wu 74247f96a9 Fix RTP player crash on invalid streams
On Linux with pulseaudio, the RTP player can crash when an invalid RTP
stream is played. Prevent that by detecting when stream playback fails.

Since the stateChanged signal receiver is registered on the same
thread, it is guaranteed that any outputStateChanged calls happen before
returning from audio_output_->start().

GTK+ not have this issue, its player simply does not show the decoded
stream at all.

Change-Id: I51a91a7f410ef3d46551bc8df0049542efbb806f
Reviewed-on: https://code.wireshark.org/review/11997
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2015-11-22 11:25:06 +00:00
Peter Wu 0fef9d752f Fix crash in RTP Player on stop and close
When dragging the UI, this somehow causes a great lag. Then by
spam-clicking on the Stop button, a double free seems to occur.

Fix this by moving the audio cleanup to the outputStateChanged callback
as documented at https://doc.qt.io/qt-5/qaudiooutput.html. Note that
calling stop() in the IdleState also triggers a change event, resulting
in the desired cleanup.

Stop streams before the dialog is closed (via accept/reject). This
*cannot* be done in the destrutor of RtpPlayerDialog because destructing
QAudioOutput processes events from the event queue, resulting in
preature destruction of other objects... crash.

Change-Id: I6bfb33c9396e9bc1ffd346519d22390a97b6bdaf
Reviewed-on: https://code.wireshark.org/review/11894
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-11-17 22:49:35 +00:00
Gerald Combs 2ccb9d2d95 Add jitter logic to RtpAudioStream.
Copy the jitter logic from rtp_player.c to rtp_audio_stream.cpp. This
still isn't correct but the RTP player should now be complete enough to
start looking at the bug list at the top of rtp_player_dialog.cpp.

Disable timing and jitter controls while we're playing while we're here.
Fixes bug 11635.

Bug: 11635
Change-Id: Ie583ade522702cbe1bbcea4475a535caa1d74fa2
Reviewed-on: https://code.wireshark.org/review/11295
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-10-27 18:00:32 +00:00
Guy Harris 4ce9655658 Don't use the non-existent decoded data if decode_rtp_packet() returns 0.
Just skip that packet.  Otherwise, it crashes.

Fix file name in the introductory comment while we're at it.

Change-Id: I286f4303a4ec152c0d00c5135395c1608bf2121a
Reviewed-on: https://code.wireshark.org/review/11279
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-10-26 10:13:43 +00:00
Gerald Combs b7de996684 RtpAudioStream: Add a cast.
Change-Id: I45d353ad900dee062775408f12d58ebb43793219
Reviewed-on: https://code.wireshark.org/review/11203
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-10-21 21:28:15 +00:00
Gerald Combs 8682eb49ef 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 <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-10-21 17:52:15 +00:00
Dario Lombardo f6d61ebfe8 qt: add missing initializers (CID 1325722)
Change-Id: Ie1ed72fe2efe31db1ce5b73ac6e659ba305f4001
Reviewed-on: https://code.wireshark.org/review/10961
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-10-13 02:55:20 +00:00
Peter Wu 89b227f44e qt: fix crash when dragging RTP player out of view
Fix invalid memory access when dragging the RTP player out of view when
a stream is selected. lowerBound() returns QMap.end() when no item is
found, use that instead.

Found using ASAN.

Change-Id: I5444a047bc242dfe481bd0581c5217030fca28f1
Reviewed-on: https://code.wireshark.org/review/10778
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-10-04 18:44:34 +00:00
Gerald Combs 8d3b97cc90 Use QVector::size instead of ::length.
Qt < 5.2 doesn't have ::length.

Change-Id: Ie6a06034c5e2ea8ddc1f9e1131a682ff9442fb75
Reviewed-on: https://code.wireshark.org/review/10754
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-10-02 21:19:34 +00:00
Gerald Combs 4d10e817b5 Distcheck fixes.
Add more speex files to the distribution.

Comment out a for-now-unused variable.

Change-Id: Iea3a0fad81e2cb599209e1c30ecbdbdb153d1328
Reviewed-on: https://code.wireshark.org/review/10749
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-10-02 19:38:39 +00:00
Guy Harris c11fea54a5 Get rid of unused variable.
Change-Id: Ife7f0c972ed67ef4f89c71faf6bc9cdccf007284
Reviewed-on: https://code.wireshark.org/review/10747
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-10-02 19:24:27 +00:00
Gerald Combs 3687d39304 Qt: Initial RTP playback.
Note the "initial". This is woefully incomplete.  See the "to do" lists
below and in the code.

This differs a bit from the GTK+ version in that you specify one or more
streams to be decoded.

Instead of showing waveforms in individual widgets, add them all to a
single QCustomPlot. This conserves screen real estate and lets us more
easily take advantage of the QCP API. It also looks better IMHO.

Change a bunch of checks for QtMultimediaWidgets to QtMultimedia. We
probably won't use the widgets until we make 5.0 our minimum Qt
version and plain old QtMultimedia lets us support Qt 4 more easily
(in theory at least).

Add resampling code from libspeex. I initially used this to resample
each packet to match the preferred rate of our output device, but this
resulted in poorer audio quality than expected. Leave it in and use to
create visual samples for QCP and to match rates any time the rate
changes. The latter is currently untested.

Add some debugging macros.

Note that both the RTP player and RTP analysis dialogs decode audio data
using different code.

Note that voip_calls_packet and voip_calls_init_tap appear to be dead
code.

To do:

- Add silence frames where needed.
- Implement the jitter buffer.
- Implement the playback timing controls.
- Tapping / scanning streams might be too slow.

Change-Id: I20dd3b66d3df53c9b1f3501262dc01458849f6b4
Bug: 9007
Reviewed-on: https://code.wireshark.org/review/10458
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-10-02 18:26:05 +00:00