Clarify camera mode ownership and codec probe structure
This commit is contained in:
1 parent
7b341d9f4f
commit
72cb1fa829
2 files changed
+15
-15
No files matched your search
@@ -6,9 +6,9 @@
|
||||
|
||||
// Только аппаратные режимы камеры, пригодные для звонка; опрос выполняется в процессе захвата.
|
||||
struct CallCameraDevice {
|
||||
QString name;
|
||||
QByteArray id;
|
||||
QList<StreamVideoMode> modes;
|
||||
QString name; // Отображаемое имя устройства.
|
||||
QByteArray id; // Непрозрачный идентификатор Qt backend.
|
||||
QList<StreamVideoMode> modes; // Аппаратные размеры до Full HD с частотой 30/29.97 fps.
|
||||
};
|
||||
using CallCameraDevices = QList<CallCameraDevice>;
|
||||
constexpr qint64 CallCameraMaxFrameAgeUs = 250000;
|
||||
|
||||
@@ -242,10 +242,10 @@ call_video_caps CallVideoDecoder::capabilities(const std::atomic<bool>* running)
|
||||
while (!guard.try_lock()) { if (cancelled()) return {}; QThread::usleep(1000); }
|
||||
if (initialized) return caps;
|
||||
call_video_caps probed{};
|
||||
for (unsigned codec = 1; codec <= 2; ++codec) {
|
||||
unsigned profiles = 0, maximumTier = 0;
|
||||
for (unsigned profile = 1; profile <= (codec == 1 ? 2u : 1u); ++profile) {
|
||||
for (unsigned tier = 0; tier < 2; ++tier) {
|
||||
for (unsigned codec = 1; codec <= 2; ++codec) {
|
||||
unsigned profiles = 0, maximumTier = 0;
|
||||
for (unsigned profile = 1; profile <= (codec == 1 ? 2u : 1u); ++profile) {
|
||||
for (unsigned tier = 0; tier < 2; ++tier) {
|
||||
const unsigned width = tier ? 1920 : 1280, height = tier ? 1080 : 720;
|
||||
for (Backend backend : {Backend::HardwareOnly, Backend::SoftwareOnly}) {
|
||||
if (cancelled()) return {};
|
||||
@@ -282,7 +282,7 @@ call_video_caps CallVideoDecoder::capabilities(const std::atomic<bool>* running)
|
||||
}
|
||||
valid = valid && received == 8 && outputBeforeEos;
|
||||
DEBUG_INFO(DEBUG_CATEGORY_CALL, "video decoder probe codec=%u profile=%u size=%ux%u backend=%d valid=%d inputs=%u outputs=%u pipeline=%u",
|
||||
codec, profile, w, h, int(backend), valid, sent, received, decoder.pipelineFrames());
|
||||
codec, profile, w, h, int(backend), valid, sent, received, decoder.pipelineFrames());
|
||||
bothOrientations = valid; backendPipeline = std::max(backendPipeline, decoder.pipelineFrames());
|
||||
}
|
||||
|
||||
@@ -298,15 +298,15 @@ call_video_caps CallVideoDecoder::capabilities(const std::atomic<bool>* running)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (profiles) {
|
||||
const uint16_t width = maximumTier ? 1920 : 1280, height = maximumTier ? 1080 : 720;
|
||||
call_video_limit limit{width, height, 30, uint32_t(width) * height * 30, 4000000, (uint8_t)profiles,
|
||||
(uint8_t)(codec == 1 ? (maximumTier ? 40 : 31) : (maximumTier ? 120 : 93))};
|
||||
if (!call_video_limit_orientations(&limit, codec)) probed.decode[codec - 1] = limit;
|
||||
}
|
||||
}
|
||||
if (profiles) {
|
||||
const uint16_t width = maximumTier ? 1920 : 1280, height = maximumTier ? 1080 : 720;
|
||||
call_video_limit limit{width, height, 30, uint32_t(width) * height * 30, 4000000, (uint8_t)profiles,
|
||||
(uint8_t)(codec == 1 ? (maximumTier ? 40 : 31) : (maximumTier ? 120 : 93))};
|
||||
if (!call_video_limit_orientations(&limit, codec)) probed.decode[codec - 1] = limit;
|
||||
}
|
||||
}
|
||||
caps = probed; initialized = true;
|
||||
return caps;
|
||||
}
|
||||
Reference in new issue
Block a user