summaryrefslogtreecommitdiffstats
path: root/pica-client/audiovideocallcontroller.h
diff options
context:
space:
mode:
authorAnton <anton@picapica.im>2026-08-13 01:28:32 +0400
committerAnton <anton@picapica.im>2026-08-13 01:28:32 +0400
commitd10deee6b3143fffd0d4d55b87bf6167c34dd459 (patch)
treed10fc58c4d8382b37046062830010d305094ee69 /pica-client/audiovideocallcontroller.h
parent07697978227d9d938a2ce2b72010d3b9cebea041 (diff)
downloadpica-pica-d10deee6b3143fffd0d4d55b87bf6167c34dd459.tar.gz
pica-pica-d10deee6b3143fffd0d4d55b87bf6167c34dd459.zip
pica-client: video call
Diffstat (limited to 'pica-client/audiovideocallcontroller.h')
-rw-r--r--pica-client/audiovideocallcontroller.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/pica-client/audiovideocallcontroller.h b/pica-client/audiovideocallcontroller.h
index 8df6af1..05a56ed 100644
--- a/pica-client/audiovideocallcontroller.h
+++ b/pica-client/audiovideocallcontroller.h
@@ -47,7 +47,10 @@ private:
AudioDevice *ringdevice;
AudioDevice *microphone;
AudioDevice *output;
+ // Local camera capture+encode.
VideoDevice *cam;
+ // Decoding of the video stream received from the peer.
+ VideoDevice *remotevideo;
bool is_active;
QByteArray m_peer_id;
@@ -65,11 +68,28 @@ private:
QThread microphone_thread;
QThread output_thread;
+ // Camera capture+encode and remote-video decode, same arrangement as
+ // the audio devices above (see VideoDevice).
+ QThread cam_thread;
+ QThread remotevideo_thread;
+
// Sequence number / capture-clock timestamp stamped onto outgoing
// 0x76 audio packets (see PICA_PROTO_CALL_PACKET_HDRSIZE).
quint16 m_audioSeq;
QElapsedTimer m_callClock;
+ // Outgoing 0x77 video packets. The counter occupies the low 15 bits of
+ // the wire sequence number, the top bit being the last fragment marker.
+ // All fragments of one encoded frame share m_videoFrameTimestamp, which
+ // is re-read from m_callClock only when a new frame starts - tracked by
+ // m_videoFrameStarted, set false again after emitting a last fragment.
+ quint16 m_videoSeq;
+ quint32 m_videoFrameTimestamp;
+ bool m_videoFrameStarted;
+
+ // Reassembly of incoming 0x77 fragments into whole encoded frames.
+ VideoFrameAssembler m_videoAssembler;
+
void playEarpieceTone(void (TonePlayer::*tone)());
void playRingTone();
void stopTones();
@@ -77,6 +97,9 @@ private:
void startAudioPipeline();
void stopAudioPipeline();
+ void startVideoPipeline();
+ void stopVideoPipeline();
+
private slots:
// button handlers
void initiate_call();
@@ -88,6 +111,10 @@ private slots:
void incoming_audio_params(QByteArray peer_id, QString codec, quint16 sample_rate);
void incoming_audio_packet(QByteArray peer_id, quint16 seq_num, quint32 timestamp, QByteArray data);
+ void send_video_packet(QByteArray data, bool is_last_fragment);
+ void incoming_video_params(QByteArray peer_id, QString codec, quint16 width, quint16 height);
+ void incoming_video_packet(QByteArray peer_id, quint16 seq_num, quint32 timestamp, QByteArray data);
+
};
#endif // AUDIOVIDEOCALLCONTROLLER_H