Попытка обновления шифрования звонков и работа над UI

This commit is contained in:
2026-03-25 01:47:12 +05:00
parent 419101a4a9
commit 530047c5d0
14 changed files with 1326 additions and 99 deletions

View File

@@ -0,0 +1,24 @@
// Minimal stub matching WebRTC M125 api/array_view.h
#ifndef API_ARRAY_VIEW_H_
#define API_ARRAY_VIEW_H_
#include <cstddef>
namespace rtc {
template <typename T>
class ArrayView final {
public:
constexpr ArrayView() noexcept : ptr_(nullptr), size_(0) {}
constexpr ArrayView(T* ptr, size_t size) noexcept : ptr_(ptr), size_(size) {}
constexpr T* data() const { return ptr_; }
constexpr size_t size() const { return size_; }
private:
T* ptr_;
size_t size_;
};
} // namespace rtc
#endif // API_ARRAY_VIEW_H_

View File

@@ -0,0 +1,42 @@
// Minimal stub matching WebRTC M125 api/crypto/frame_decryptor_interface.h
#ifndef API_CRYPTO_FRAME_DECRYPTOR_INTERFACE_H_
#define API_CRYPTO_FRAME_DECRYPTOR_INTERFACE_H_
#include <cstddef>
#include <cstdint>
#include <vector>
#include "webrtc/rtc_base/ref_count.h"
#include "webrtc/api/array_view.h"
#include "webrtc/api/media_types.h"
namespace webrtc {
class FrameDecryptorInterface : public rtc::RefCountInterface {
public:
struct Result {
enum class Status { kOk = 0, kRecoverable, kFailedToDecrypt };
Result(Status s, size_t bw) : status(s), bytes_written(bw) {}
bool IsOk() const { return status == Status::kOk; }
Status status;
size_t bytes_written;
};
virtual Result Decrypt(cricket::MediaType media_type,
const std::vector<uint32_t>& csrcs,
rtc::ArrayView<const uint8_t> additional_data,
rtc::ArrayView<const uint8_t> encrypted_frame,
rtc::ArrayView<uint8_t> frame) = 0;
virtual size_t GetMaxPlaintextByteSize(cricket::MediaType media_type,
size_t encrypted_frame_size) = 0;
protected:
~FrameDecryptorInterface() override {}
};
} // namespace webrtc
#endif // API_CRYPTO_FRAME_DECRYPTOR_INTERFACE_H_

View File

@@ -0,0 +1,32 @@
// Minimal stub matching WebRTC M125 api/crypto/frame_encryptor_interface.h
#ifndef API_CRYPTO_FRAME_ENCRYPTOR_INTERFACE_H_
#define API_CRYPTO_FRAME_ENCRYPTOR_INTERFACE_H_
#include <cstddef>
#include <cstdint>
#include "webrtc/rtc_base/ref_count.h"
#include "webrtc/api/array_view.h"
#include "webrtc/api/media_types.h"
namespace webrtc {
class FrameEncryptorInterface : public rtc::RefCountInterface {
public:
virtual int Encrypt(cricket::MediaType media_type,
uint32_t ssrc,
rtc::ArrayView<const uint8_t> additional_data,
rtc::ArrayView<const uint8_t> frame,
rtc::ArrayView<uint8_t> encrypted_frame,
size_t* bytes_written) = 0;
virtual size_t GetMaxCiphertextByteSize(cricket::MediaType media_type,
size_t frame_size) = 0;
protected:
~FrameEncryptorInterface() override {}
};
} // namespace webrtc
#endif // API_CRYPTO_FRAME_ENCRYPTOR_INTERFACE_H_

View File

@@ -0,0 +1,14 @@
// Minimal stub matching WebRTC M125 api/media_types.h
#ifndef API_MEDIA_TYPES_H_
#define API_MEDIA_TYPES_H_
namespace cricket {
enum MediaType {
MEDIA_TYPE_AUDIO,
MEDIA_TYPE_VIDEO,
MEDIA_TYPE_DATA,
MEDIA_TYPE_UNSUPPORTED
};
} // namespace cricket
#endif // API_MEDIA_TYPES_H_

View File

@@ -0,0 +1,21 @@
// Minimal stub matching WebRTC M125 rtc_base/ref_count.h
#ifndef RTC_BASE_REF_COUNT_H_
#define RTC_BASE_REF_COUNT_H_
namespace rtc {
enum class RefCountReleaseStatus { kDroppedLastRef, kOtherRefsRemained };
// Must match the EXACT virtual layout of the real rtc::RefCountInterface.
class RefCountInterface {
public:
virtual void AddRef() const = 0;
virtual RefCountReleaseStatus Release() const = 0;
protected:
virtual ~RefCountInterface() {}
};
} // namespace rtc
#endif // RTC_BASE_REF_COUNT_H_