WinterGram/tools/tgcalls_cli/fake_video_source.h
Isaac 5962a563e4 feat: tgcalls CLI test tool with group SFU, video, and adaptation
Squashed buildout of the tgcalls testbench:

- CLI test tool with --mode p2p/reflector/group/group-churn,
  cross-version interop (--version, --version2), and quiet/summary output
- Linux toolchain + Docker multi-stage build, AWS Fargate mass test harness,
  local parallel mass test harness with signaling loss simulation
- SCTP writable gate, retransmission timer tuning, role-based handshake
- InstanceV2CompatImpl (PeerConnection backend with V2Impl signaling) and
  SignalingTranslator for v14.0.0 interop
- In-process Go/Pion SFU (ICE+DTLS+SRTP+SCTP per participant) with audio
  RTP forwarding, ActiveAudio/VideoSsrcs data channel broadcast, RTCP
  feedback path, and CGo c-archive integration
- GroupInstanceReferenceImpl (PeerConnection group-call) and mixed-impl
  group mode (--reference-participants), with SDP munging for simulcast
- H264 simulcast group video (FakeVideoTrackSource pattern generator,
  FakeVideoSink frame counting, --video flag, two-pass channel setup,
  reactive video setup from ActiveVideoSsrcs)
- Group churn stress mode (--mode group-churn, --churn-cycles)
- SFU stream-quality adaptation: BandwidthEstimator, LayerSelector
  state machine, RtxRingBuffer, simulcast SSRC rewrite
- Transport-cc feedback generation, NetworkSimulator (delay/jitter/loss/
  token-bucket bandwidth), --network-scenario step-down-up
- CLAUDE.md updates throughout

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 18:28:43 +02:00

38 lines
1.1 KiB
C++

#pragma once
#include "api/video/i420_buffer.h"
#include "media/base/adapted_video_track_source.h"
#include "rtc_base/ref_counted_object.h"
#include <atomic>
#include <thread>
// Generates 640x360 I420 frames at 30fps with per-participant color tint
// and an incrementing frame counter rendered as block digits.
class FakeVideoTrackSource : public rtc::AdaptedVideoTrackSource {
public:
static rtc::scoped_refptr<FakeVideoTrackSource> Create(int participantId);
~FakeVideoTrackSource() override;
void Stop();
// VideoTrackSourceInterface
SourceState state() const override { return kLive; }
bool remote() const override { return false; }
bool is_screencast() const override { return false; }
absl::optional<bool> needs_denoising() const override { return false; }
protected:
explicit FakeVideoTrackSource(int participantId);
private:
void GenerateThread();
void RenderDigits(uint8_t* yPlane, int strideY, int frameNumber);
int participantId_;
uint8_t uTint_;
uint8_t vTint_;
std::atomic<bool> running_{true};
std::thread thread_;
};