Skip to content

Commit

Permalink
OpenMax: Fix failure when resolution changes. Fixes #12643
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Bennett authored and stuartm committed Mar 21, 2016
1 parent 5d06abc commit 7fb92b9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
9 changes: 6 additions & 3 deletions mythtv/libs/libmythtv/avformatdecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3281,15 +3281,15 @@ void AvFormatDecoder::MpegPreProcessPkt(AVStream *stream, AVPacket *pkt)

if (changed)
{
if (private_dec)
private_dec->Reset();

m_parent->SetVideoParams(width, height, seqFPS, kScan_Detect);

current_width = width;
current_height = height;
fps = seqFPS;

if (private_dec)
private_dec->Reset();

gopset = false;
prevgoppos = 0;
firstvpts = lastapts = lastvpts = lastccptsu = 0;
Expand Down Expand Up @@ -3388,6 +3388,9 @@ int AvFormatDecoder::H264PreProcessPkt(AVStream *stream, AVPacket *pkt)

if (fps_changed || res_changed)
{
if (private_dec)
private_dec->Reset();

m_parent->SetVideoParams(width, height, seqFPS, kScan_Detect);

current_width = width;
Expand Down
10 changes: 3 additions & 7 deletions mythtv/libs/libmythtv/privatedecoder_omx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,9 +567,8 @@ OMX_ERRORTYPE PrivateDecoderOMX::FreeOutputBuffersCB()
m_lock.unlock();

VideoFrame *frame = HDR2FRAME(hdr);
if (frame)
if (frame && FRAME2HDR(frame) == hdr)
{
assert(FRAME2HDR(frame) == hdr);
FRAMESETHDR(frame, 0);

AVBufferRef *ref = FRAME2REF(frame);
Expand Down Expand Up @@ -665,7 +664,6 @@ OMX_ERRORTYPE PrivateDecoderOMX::UseBuffersCB()

VideoFrame *frame = (VideoFrame*)picture->opaque;
assert(frame);
assert(unsigned(frame->size) >= def.nBufferSize);

OMX_BUFFERHEADERTYPE *hdr;
e = OMX_UseBuffer(m_videc.Handle(), &hdr, m_videc.Base() + index, frame,
Expand Down Expand Up @@ -950,11 +948,9 @@ int PrivateDecoderOMX::GetBufferedFrame(AVStream *stream, AVFrame *picture)
picture->reordered_opaque = Ticks2Pts(stream, hdr->nTimeStamp);

VideoFrame *frame = HDR2FRAME(hdr);
if (frame)
{
assert(FRAME2HDR(frame) == hdr);
assert(FRAME2REF(frame));

if (frame && FRAME2HDR(frame) == hdr)
{
frame->bpp = bitsperpixel(frametype);
frame->codec = frametype;
frame->width = vdef.nFrameWidth;
Expand Down

0 comments on commit 7fb92b9

Please sign in to comment.