diff options
Diffstat (limited to 'pica-client/dialogs/settingsdialog.h')
| -rw-r--r-- | pica-client/dialogs/settingsdialog.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/pica-client/dialogs/settingsdialog.h b/pica-client/dialogs/settingsdialog.h index 06a2f13..881dd29 100644 --- a/pica-client/dialogs/settingsdialog.h +++ b/pica-client/dialogs/settingsdialog.h @@ -27,8 +27,12 @@ #include <QLabel> #include <QThread> #include <QImage> +#include <QList> +#include <QTimer> #include "../mediadevice.h" +#include "../audiodevice.h" #include "../videodevice.h" +#include "../toneplayer/toneplayer.h" class SettingsDialog : public QDialog { @@ -64,7 +68,49 @@ private: QComboBox *videoDev; QPushButton *videoDevRefresh; + // Local audio pipeline test: a few seconds of the selected microphone are + // captured and encoded, then decoded again and played back through the + // selected playback device - the same path a call takes, minus the + // network. Recording and playback are deliberately kept apart in time + // rather than looped back live, which would howl with acoustic feedback + // when the test runs on speakers. QPushButton *btAudioTest; + QLabel *audioTestStatus; + AudioDevice *testMic; + AudioDevice *testSpeaker; + QThread testMicThread; + QThread testSpeakerThread; + + enum AudioTestState + { + AudioTestIdle, + AudioTestRecording, + AudioTestPlaying + }; + + AudioTestState audioTestState; + // The recording, as encoded packets, and how far playback has fed it. + QList<QByteArray> audioTestPackets; + int audioTestPlaybackPos; + // Members rather than QTimer::singleShot() calls so that stopping a test + // cancels them - otherwise a timer left over from an aborted run would + // fire into the next one. + QTimer *audioTestRecordTimer; + QTimer *audioTestPlaybackTimer; + QTimer *audioTestDrainTimer; + + void stopAudioTest(); + void startAudioTestPlayback(); + + // Ring device test: plays the incoming call bell through the selected + // ring device, using the same TonePlayer an actual incoming call uses. + // TonePlayer::play() blocks its thread for the length of the tone + // sequence, hence the dedicated thread. + QPushButton *btRingTest; + QLabel *ringTestStatus; + TonePlayer *ringTestPlayer; + QThread ringTestPlayerThread; + bool ringTestRunning; // Local video pipeline test: frames from the selected camera are // encoded, split into protocol sized fragments, reassembled and decoded @@ -99,6 +145,17 @@ private slots: void fillAudioPlaybackDevices(); void fillAudioRingDevices(); + void toggleRingTest(); + void ringTestFinished(); + void ringTestError(QString message); + + void toggleAudioTest(); + void audioTestPacket(QByteArray data); + void audioTestRecordingFinished(); + void audioTestFeedPacket(); + void audioTestPlaybackFinished(); + void audioTestError(QString message); + void toggleVideoTest(); void videoTestFragment(QByteArray data, bool is_last_fragment); void videoTestFrame(QImage frame); |
