diff options
author | Jirka Novak <j.novak@netsystem.cz> | 2021-03-23 09:48:20 +0100 |
---|---|---|
committer | Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org> | 2021-03-24 09:23:52 +0000 |
commit | 2a4859bd143c04bf2ac3b8051672cedfcc5cd5b5 (patch) | |
tree | 7045d113a4958769d804cc0f8bbcf01c16d86bba /ui/qt/rtp_audio_stream.cpp | |
parent | 2e6d3b571b50f6a0df31787cb95ba0f66c4fa85f (diff) |
RTP Player: UI improvements
Changes:
- all waveforms has common scale therefore louder/quiter signal is visible
- when stream/streams are deleted from view, Y axis is rescaled and
waveforms are rearranged to reuse empty space
Diffstat (limited to 'ui/qt/rtp_audio_stream.cpp')
-rw-r--r-- | ui/qt/rtp_audio_stream.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/ui/qt/rtp_audio_stream.cpp b/ui/qt/rtp_audio_stream.cpp index 44fe3b8f42..324d9f20a5 100644 --- a/ui/qt/rtp_audio_stream.cpp +++ b/ui/qt/rtp_audio_stream.cpp @@ -52,6 +52,7 @@ RtpAudioStream::RtpAudioStream(QObject *parent, rtpstream_info_t *rtpstream, boo audio_resampler_(0), audio_output_(0), max_sample_val_(1), + max_sample_val_used_(1), color_(0), jitter_buffer_size_(50), timing_mode_(RtpAudioStream::JitterBuffer), @@ -457,6 +458,7 @@ void RtpAudioStream::decodeVisual() } } + max_sample_val_used_ = max_sample_val_; g_free(resample_buff); g_free(read_buff); } @@ -480,18 +482,15 @@ const QVector<double> RtpAudioStream::visualTimestamps(bool relative) return adj_timestamps; } -// Scale the height of the waveform (max_sample_val_) and adjust its Y -// offset so that they overlap slightly (stack_offset_). - -// XXX This means that waveforms can be misleading with respect to relative -// amplitude. We might want to add a "global" max_sample_val_. +// Scale the height of the waveform to global scale (max_sample_val_used_) +// and adjust its Y offset so that they overlap slightly (stack_offset_). static const double stack_offset_ = G_MAXINT16 / 3; const QVector<double> RtpAudioStream::visualSamples(int y_offset) { QVector<double> adj_samples; double scaled_offset = y_offset * stack_offset_; for (int i = 0; i < visual_samples_.size(); i++) { - adj_samples.append(((double)visual_samples_[i] * G_MAXINT16 / max_sample_val_) + scaled_offset); + adj_samples.append(((double)visual_samples_[i] * G_MAXINT16 / max_sample_val_used_) + scaled_offset); } return adj_samples; } |