Skip to content

Commit

Permalink
MythVideoOutputGPU: Guard against errors in CreateSecondaryVideo
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-kendall committed Sep 8, 2020
1 parent 4db35a9 commit 01229e5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
18 changes: 11 additions & 7 deletions mythtv/libs/libmythtv/mythvideooutgpu.cpp
Expand Up @@ -495,7 +495,7 @@ void MythVideoOutputGPU::RenderFrameGPU(VideoFrame *Frame, FrameScanType Scan,
{
for (auto it = m_pxpVideos.begin(); it != m_pxpVideos.end(); ++it)
{
if (m_pxpVideosReady[it.key()])
if (m_pxpVideosReady[it.key()] && (*it))
{
bool active = m_pxpVideoActive == *it;
if (stereo)
Expand Down Expand Up @@ -693,14 +693,18 @@ void MythVideoOutputGPU::ShowPIP(MythPlayer* PiPPlayer, PIPLocation Location)
}

m_pxpVideos[PiPPlayer] = video;
if (!video->IsValid())

if (video)
{
PiPPlayer->ReleaseCurrentFrame(pipimage);
return;
if (!video->IsValid())
{
PiPPlayer->ReleaseCurrentFrame(pipimage);
return;
}
video->SetMasterViewport(dvr.size());
video->SetVideoRects(position, pipvideorect);
video->PrepareFrame(pipimage);
}
video->SetMasterViewport(dvr.size());
video->SetVideoRects(position, pipvideorect);
video->PrepareFrame(pipimage);

m_pxpVideosReady[PiPPlayer] = true;
if (PiPPlayer->IsPIPActive())
Expand Down
5 changes: 5 additions & 0 deletions mythtv/libs/libmythtv/opengl/mythvideooutopengl.cpp
Expand Up @@ -404,6 +404,11 @@ MythVideoGPU* MythVideoOutputOpenGL::CreateSecondaryVideo(const QSize& VideoDim,
VideoDim, VideoDispDim,
DisplayVisibleRect, DisplayVideoRect,
VideoRect, false, m_profile);
if (result && !result->IsValid())
{
delete result;
result = nullptr;
}
colourspace->DecrRef();
return result;
}

0 comments on commit 01229e5

Please sign in to comment.