webrtc: request keyframe exactly once
This commit is contained in:
parent
a8a3e4242b
commit
e4d5986e99
@ -107,19 +107,20 @@ public:
|
|||||||
|
|
||||||
void pushFrame(buffer_t *buf)
|
void pushFrame(buffer_t *buf)
|
||||||
{
|
{
|
||||||
auto self = this;
|
|
||||||
|
|
||||||
if (!video || !video->track) {
|
if (!video || !video->track) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!had_key_frame) {
|
if (!had_key_frame) {
|
||||||
if (!buf->flags.is_keyframe) {
|
had_key_frame = buf->flags.is_keyframe;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!had_key_frame) {
|
||||||
|
if (!requested_key_frame) {
|
||||||
device_video_force_key(buf->buf_list->dev);
|
device_video_force_key(buf->buf_list->dev);
|
||||||
LOG_VERBOSE(self, "Skipping as key frame was not yet sent.");
|
requested_key_frame = true;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
had_key_frame = true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc::binary data((std::byte*)buf->start, (std::byte*)buf->start + buf->used);
|
rtc::binary data((std::byte*)buf->start, (std::byte*)buf->start + buf->used);
|
||||||
@ -135,6 +136,7 @@ public:
|
|||||||
std::mutex lock;
|
std::mutex lock;
|
||||||
std::condition_variable wait_for_complete;
|
std::condition_variable wait_for_complete;
|
||||||
bool had_key_frame;
|
bool had_key_frame;
|
||||||
|
bool requested_key_frame;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::shared_ptr<Client> findClient(std::string id)
|
std::shared_ptr<Client> findClient(std::string id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user