|
|
|
|
@ -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; |
|
|
|
|
} |
|
|
|
|
|