mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
fix(video): fix invalid VideoSource ID allocation
This commit fixes the an invalid ID allocation by VideoSource, before this commit all VideoSources receives the same ID causing VideoFrame to believe all frames belong to the same video source. Additionally, this commit addresses issues with deprecated pixel formats and silences libswscale warnings.
This commit is contained in:
parent
607b8d5a20
commit
707f7af29a
|
@ -97,6 +97,46 @@ VideoFrame::VideoFrame(IDType sourceID, AVFrame* sourceFrame, QRect dimensions,
|
||||||
sourceFrameKey(getFrameKey(dimensions.size(), pixFmt, sourceFrame->linesize[0])),
|
sourceFrameKey(getFrameKey(dimensions.size(), pixFmt, sourceFrame->linesize[0])),
|
||||||
freeSourceFrame(freeSourceFrame)
|
freeSourceFrame(freeSourceFrame)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// We override the pixel format in the case a deprecated one is used
|
||||||
|
switch(pixFmt)
|
||||||
|
{
|
||||||
|
case AV_PIX_FMT_YUVJ420P:
|
||||||
|
{
|
||||||
|
pixFmt = AV_PIX_FMT_YUV420P;
|
||||||
|
sourceFrame->color_range = AVCOL_RANGE_MPEG;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case AV_PIX_FMT_YUVJ411P:
|
||||||
|
{
|
||||||
|
pixFmt = AV_PIX_FMT_YUV411P;
|
||||||
|
sourceFrame->color_range = AVCOL_RANGE_MPEG;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case AV_PIX_FMT_YUVJ422P:
|
||||||
|
{
|
||||||
|
pixFmt = AV_PIX_FMT_YUV422P;
|
||||||
|
sourceFrame->color_range = AVCOL_RANGE_MPEG;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case AV_PIX_FMT_YUVJ444P:
|
||||||
|
{
|
||||||
|
pixFmt = AV_PIX_FMT_YUV444P;
|
||||||
|
sourceFrame->color_range = AVCOL_RANGE_MPEG;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case AV_PIX_FMT_YUVJ440P:
|
||||||
|
{
|
||||||
|
pixFmt = AV_PIX_FMT_YUV440P;
|
||||||
|
sourceFrame->color_range = AVCOL_RANGE_MPEG;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
frameBuffer[sourceFrameKey] = sourceFrame;
|
frameBuffer[sourceFrameKey] = sourceFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ public:
|
||||||
using AtomicIDType = std::atomic_uint_fast64_t;
|
using AtomicIDType = std::atomic_uint_fast64_t;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VideoSource() : id(sourceIDs.fetch_add(std::memory_order_relaxed)){}
|
VideoSource() : id(sourceIDs++){}
|
||||||
|
|
||||||
virtual ~VideoSource() = default;
|
virtual ~VideoSource() = default;
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user