diff options
| author | Anton <anton@picapica.im> | 2026-11-11 07:22:19 +0400 |
|---|---|---|
| committer | Anton <anton@picapica.im> | 2026-11-11 07:22:19 +0400 |
| commit | 5ead3432dba8c0e2724f796c9765612a7bf36a31 (patch) | |
| tree | c7b238cf823c266e59cb7f33367770f2d8ed7163 /pica-client/callsettings.cpp | |
| parent | 5d70834359245f0350496abfa08ca86de3847780 (diff) | |
| download | pica-pica-5ead3432dba8c0e2724f796c9765612a7bf36a31.tar.gz pica-pica-5ead3432dba8c0e2724f796c9765612a7bf36a31.zip | |
pica-client: codec names from the allow list only
Diffstat (limited to 'pica-client/callsettings.cpp')
| -rw-r--r-- | pica-client/callsettings.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/pica-client/callsettings.cpp b/pica-client/callsettings.cpp index 586fbae..dff72f4 100644 --- a/pica-client/callsettings.cpp +++ b/pica-client/callsettings.cpp @@ -36,6 +36,29 @@ const CallCodecInfo kCallAudioCodecs[] = const int kCallAudioCodecCount = sizeof(kCallAudioCodecs) / sizeof(kCallAudioCodecs[0]); +bool callAudioCodecAccepted(const QString &codec) +{ + for (int i = 0; i < kCallAudioCodecCount; i++) + if (codec == QLatin1String(kCallAudioCodecs[i].name)) + return true; + + return false; +} + +bool callVideoCodecAccepted(const QString &codec) +{ + for (int i = 0; i < kCallVideoCodecCount; i++) + if (codec == QLatin1String(kCallVideoCodecs[i].name)) + return true; + + // A camera's own compressed stream is forwarded untouched, so a sender may + // legitimately name a capture format that is not in the encode list. + if (codec == QLatin1String("mjpeg")) + return true; + + return false; +} + int callAudioSampleRate(const QString &codec) { // G.722 is a 16kHz codec by definition - it subband-codes a 7kHz audio |
