New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CDVDDemuxFFmpeg: also check for extradata_size change before adding a disabled stream #23173
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems ok. I'm curious though when this would happen?
|
I've made some formatting changes to meet the current code style. The diffs are available in the following links: For more information please see our current code style guidelines. |
@@ -1223,7 +1223,8 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() | |||
else if (stream->type == STREAM_VIDEO) | |||
{ | |||
if (static_cast<CDemuxStreamVideo*>(stream)->iWidth != m_pFormatContext->streams[pPacket->iStreamId]->codecpar->width || | |||
static_cast<CDemuxStreamVideo*>(stream)->iHeight != m_pFormatContext->streams[pPacket->iStreamId]->codecpar->height) | |||
static_cast<CDemuxStreamVideo*>(stream)->iHeight != m_pFormatContext->streams[pPacket->iStreamId]->codecpar->height || | |||
(stream->disabled && stream->ExtraSize != m_pFormatContext->streams[pPacket->iStreamId]->codecpar->extradata_size)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lrusak what you think to make as (to prevent unneeded compares):
if (!stream->disabled && (static_cast<CDemuxStreamVideo*>(stream)->iWidth != m_pFormatContext->streams[pPacket->iStreamId]->codecpar->width ||
static_cast<CDemuxStreamVideo*>(stream)->iHeight != m_pFormatContext->streams[pPacket->iStreamId]->codecpar->height) ||
stream->ExtraSize != m_pFormatContext->streams[pPacket->iStreamId]->codecpar->extradata_size)
Or to have more short and less in mem works:
const auto codecpar = m_pFormatContext->streams[pPacket->iStreamId]->codecpar;
const auto videostream = static_cast<CDemuxStreamVideo*>(stream);
if (!stream->disabled && (videostream->iWidth != codecpar->width ||
videostream->iHeight != codecpar->height) ||
videostream->ExtraSize != codecpar->extradata_size)
Due to missing compiler not tested now!
Thanks @samnazarko, good improvement, can be become bad if a extradata becomes not given complete in all cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looked in the whole function, about the codecpar
, maybe the best on begin of "if":
// check streams, can we make this a bit more simple?
if (pPacket->iStreamId >= 0)
{
const auto codecpar = m_pFormatContext->streams[pPacket->iStreamId]->codecpar;
CDemuxStream* stream = GetStream(pPacket->iStreamId);
...
and then maybe better as separate request?
Description
This issue was discovered when implementing 3D MVC support.
How has this been tested?
This has been tested on OSMC Vero 4K / 4K + devices since 2020.
What is the effect on users?
Screenshots (if appropriate):
Types of change
Checklist: