Commit Graph

19 Commits

Author SHA1 Message Date
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