summaryrefslogtreecommitdiffstats
path: root/pica-client/audiovideocallcontroller.cpp
diff options
context:
space:
mode:
authorAnton <anton@picapica.im>2026-11-11 07:22:19 +0400
committerAnton <anton@picapica.im>2026-11-11 07:22:19 +0400
commit5ead3432dba8c0e2724f796c9765612a7bf36a31 (patch)
treec7b238cf823c266e59cb7f33367770f2d8ed7163 /pica-client/audiovideocallcontroller.cpp
parent5d70834359245f0350496abfa08ca86de3847780 (diff)
downloadpica-pica-5ead3432dba8c0e2724f796c9765612a7bf36a31.tar.gz
pica-pica-5ead3432dba8c0e2724f796c9765612a7bf36a31.zip
pica-client: codec names from the allow list only
Diffstat (limited to 'pica-client/audiovideocallcontroller.cpp')
-rw-r--r--pica-client/audiovideocallcontroller.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/pica-client/audiovideocallcontroller.cpp b/pica-client/audiovideocallcontroller.cpp
index 5b3c05c..8f7c8df 100644
--- a/pica-client/audiovideocallcontroller.cpp
+++ b/pica-client/audiovideocallcontroller.cpp
@@ -483,6 +483,14 @@ void AudioVideoCallController::incoming_audio_params(QByteArray peer_id, QString
if (!is_active || peer_id != m_peer_id)
return;
+ // The codec name is peer-supplied and would otherwise be handed straight
+ // to the FFmpeg decoder - accept only the ones the client itself sends.
+ if (!callAudioCodecAccepted(codec))
+ {
+ qWarning() << "rejecting unsupported call audio codec from peer:" << codec;
+ return;
+ }
+
Settings st(config_dbname);
QString playDev = st.loadValue("audio.playback_device", "default").toString();
@@ -578,6 +586,14 @@ void AudioVideoCallController::incoming_video_params(QByteArray peer_id, QString
if (!is_active || peer_id != m_peer_id)
return;
+ // As in incoming_audio_params(): the peer-supplied codec name must be one
+ // we actually send before it reaches avcodec_find_decoder_by_name().
+ if (!callVideoCodecAccepted(codec))
+ {
+ qWarning() << "rejecting unsupported call video codec from peer:" << codec;
+ return;
+ }
+
Settings st(config_dbname);
const CallSettings cs = CallSettings::load();
bool vaapiRendering = st.loadValue("video.vaapi_rendering", 0).toBool();