71 const std::shared_ptr<MediaRecorder>&
rec);
78 void start(std::unique_ptr<dhtnet::IceSocket>
rtp_sock, std::unique_ptr<dhtnet::IceSocket>
rtcp_sock)
override;
113 void setupVideoPipeline();
116 void startReceiver();
118 using clock = std::chrono::steady_clock;
119 using time_point = clock::time_point;
123 std::unique_ptr<VideoSender> sender_;
124 std::shared_ptr<VideoReceiveThread> receiveThread_;
126 std::shared_ptr<VideoMixer> videoMixer_;
127 std::shared_ptr<VideoInput> videoLocal_;
130 std::function<
void(
void)> requestKeyFrameCallback_;
133 bool check_RCTP_Info_REMB(
uint64_t*);
134 void adaptQualityAndBitrate();
135 void storeVideoBitrateInfo();
136 void setupVideoBitrateInfo();
137 void checkReceiver();
138 float getPonderateLoss(
float lastLoss);
141 void delayProcessing(
int br);
142 void setNewBitrate(
unsigned int newBR);
145 static constexpr float NO_INFO_CALCULATED {-1.0};
147 VideoBitrateInfo videoBitrateInfo_;
148 std::list<std::pair<time_point, float>> histoLoss_;
151 static constexpr unsigned MAX_ADAPTATIVE_BITRATE_ITERATION {5};
153 static constexpr float PACKET_LOSS_THRESHOLD {1.0};
155 InterruptedThreadLoop rtcpCheckerThread_;
156 void processRtcpChecker();
158 std::function<
void(
int)> changeOrientationCallback_;
160 std::function<
void(
bool)> recordingStateCallback_;
163 std::chrono::seconds rtcp_checking_interval {4};
165 time_point lastMediaRestart_ {time_point::min()};
166 time_point last_REMB_inc_ {time_point::min()};
167 time_point last_REMB_dec_ {time_point::min()};
168 time_point lastBitrateDecrease {time_point::min()};
170 unsigned remb_dec_cnt_ {0};
172 std::unique_ptr<CongestionControl> cc;
174 std::function<
void(
void)> cbKeyFrameRequest_;
176 std::atomic<int> rotation_ {0};
178 void attachRemoteRecorder(
const MediaStream& ms);
179 void attachLocalRecorder(
const MediaStream& ms);