Browse Source

Use current FFmpeg profile constants and qualify video port status

stream-multiview
evgeny 1 week ago
parent
commit
d01bc395fa
  1. 4
      tools/chatgui/src/call_video_decoder.cpp
  2. 2
      tools/chatgui/src/call_video_engine.cpp

4
tools/chatgui/src/call_video_decoder.cpp

@ -59,7 +59,7 @@ bool CallVideoDecoder::decode(const call_video_frame& f, QImage& image) {
}
bool valid = result >= 0 && decoded->pts == f.pts_us && decoded->width == f.format.width && decoded->height == f.format.height
&& decoded->format == AV_PIX_FMT_YUV420P && !m->codec->has_b_frames && m->codec->level <= f.format.level;
int profile = f.format.codec == CALL_VIDEO_H265 ? FF_PROFILE_HEVC_MAIN : FF_PROFILE_H264_CONSTRAINED_BASELINE;
int profile = f.format.codec == CALL_VIDEO_H265 ? AV_PROFILE_HEVC_MAIN : AV_PROFILE_H264_CONSTRAINED_BASELINE;
valid = valid && m->codec->profile == profile;
if (valid) {
QImage output(decoded->width, decoded->height, QImage::Format_RGB888);
@ -67,7 +67,7 @@ bool CallVideoDecoder::decode(const call_video_frame& f, QImage& image) {
decoded->width, decoded->height, AV_PIX_FMT_RGB24, SWS_FAST_BILINEAR, nullptr, nullptr, nullptr);
if (!m->scale || output.isNull()) valid = false;
else {
uint8_t* planes[4] = {output.bits(), nullptr, nullptr, nullptr}; int strides[4] = {output.bytesPerLine(), 0, 0, 0};
uint8_t* planes[4] = {output.bits(), nullptr, nullptr, nullptr}; int strides[4] = {(int)output.bytesPerLine(), 0, 0, 0};
valid = sws_scale(m->scale, decoded->data, decoded->linesize, 0, decoded->height, planes, strides) == decoded->height;
if (valid) image = f.format.rotation ? output.transformed(QTransform().rotate(f.format.rotation)) : output;
}

2
tools/chatgui/src/call_video_engine.cpp

@ -148,7 +148,7 @@ void CallVideoEngine::transmit() {
int64_t lastPts = -1, lastKey = -1;
bool forceKey = true;
while (m->running) {
call_video_port_status state{};
struct call_video_port_status state{};
if (call_video_port_status(m->id, &state) < 0) break;
uint64_t revision; bool enabled; int width, height, codec; int64_t pts;
#ifdef HAVE_STREAM_CAPTURE

Loading…
Cancel
Save