Preserve explicit VBV and report inactive call encoder state
This commit is contained in:
1 parent
0f570edbd0
commit
cab992228c
2 files changed
+5
-3
No files matched your search
@@ -2,7 +2,8 @@
|
||||
* Смена bitrate ожидает ближайший IDR (период <= 1с по capture PTS). Новый encoder
|
||||
* заменяет старый только после полного первого IDR. Completion передаётся в uasync
|
||||
* независимо от admission видео. PTS, generation и frame_id принадлежат владельцу.
|
||||
* open получает уже согласованный profile/level/VBV; сетевой CAPS проверяет владелец. */
|
||||
* open получает уже согласованный profile/level/VBV и предел bitrate данного режима;
|
||||
* сетевой CAPS и соответствие размера/FPS этому envelope проверяет владелец. */
|
||||
#pragma once
|
||||
#include "live_video_encoder.h"
|
||||
|
||||
@@ -18,7 +19,7 @@ public:
|
||||
bool requestBitrate(uint64_t generation, uint64_t request, uint32_t bitrate);
|
||||
// Один вход -> один выход. На false output не меняется; completion нужно обработать и на ошибке.
|
||||
bool encode(const QImage& image, uint64_t pts, bool forceKey, LiveEncodedFrame& output, CallVideoRateCompletion& completion);
|
||||
uint32_t bitrate() const { return m_config.bitrate; }
|
||||
uint32_t bitrate() const { return m_encoder ? m_config.bitrate : 0; }
|
||||
QString error() const { return m_error; }
|
||||
private:
|
||||
std::unique_ptr<LiveVideoEncoder> m_encoder;
|
||||
|
||||
@@ -325,7 +325,8 @@ bool LiveVideoEncoder::setBitrate(int bitrate) {
|
||||
#ifdef HAVE_FFMPEG
|
||||
// libx264 перечитывает эти три значения через reconfig_encoder при подаче следующего кадра.
|
||||
if (m->codec && m->name == "libx264" && m->config.profile == LiveVideoProfile::Automatic) {
|
||||
m->codec->bit_rate = m->codec->rc_max_rate = bitrate; m->codec->rc_buffer_size = bitrate / 4; m->config.bitrate = bitrate;
|
||||
m->codec->bit_rate = m->codec->rc_max_rate = bitrate;
|
||||
m->codec->rc_buffer_size = m->config.vbvBits ? m->config.vbvBits : bitrate / 4; m->config.bitrate = bitrate;
|
||||
DEBUG_INFO(DEBUG_CATEGORY_VIDEO, "desktop encoder bitrate updated in place name=libx264 bitrate=%d", bitrate); return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user