Skip to content

Commit

Permalink
Handle some stream and layout errors
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderAgd committed Apr 28, 2017
1 parent 0829931 commit 8991697
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/rtsp-stream/RtspStreamFrameFormatter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ void RtspStreamFrameFormatter::updateSWSContext(int dstWidth, int dstHeight)
break;
case AV_PIX_FMT_YUVJ440P :
pixFormat = AV_PIX_FMT_YUV440P;
break;
case AV_PIX_FMT_NONE:
pixFormat = AV_PIX_FMT_YUV420P; /* Try mostly used format */
break;
default:
pixFormat = (AVPixelFormat) m_stream->codecpar->format;
break;
Expand Down
1 change: 1 addition & 0 deletions src/rtsp-stream/RtspStreamWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ void RtspStreamWorker::openCodecs(AVFormatContext *context, AVDictionary *option
{
m_videoStreamIndex = i;
m_videoCodecCtx = avctx;
setFrameSizeHint(m_videoCodecCtx->width, m_videoCodecCtx->height);
}

if (stream->codecpar->codec_type==AVMEDIA_TYPE_AUDIO)
Expand Down
7 changes: 3 additions & 4 deletions src/ui/liveview/LiveStreamItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,6 @@ void LiveStreamItem::paint(QPainter *p, const QStyleOptionGraphicsItem *opt, QWi
return;
}



/* For advanced GL textures that were invalidated (deleted when the relevant context
* was not current), attempt to delete them here if appropriate. */
/*const bool glContextChanged = QGLContext::currentContext() != m_texLastContext;
Expand Down Expand Up @@ -225,9 +223,10 @@ void LiveStreamItem::paint(QPainter *p, const QStyleOptionGraphicsItem *opt, QWi
p->drawImage(opt->rect, frame);
p->restore();

m_stream.data()->setFrameSizeHint(opt->rect.width(), opt->rect.height());
/* In some cases opt rect width and height may be negative */
if (opt->rect.width() > 0 && opt->rect.height() > 0)
m_stream.data()->setFrameSizeHint(opt->rect.width(), opt->rect.height());
}

}
/*
void LiveStreamItem::updateSettings()
Expand Down

0 comments on commit 8991697

Please sign in to comment.