mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-06 17:46:50 +08:00
[mpi]: Fix stuck on block output mode decode call
When the output mode is set to block user call decode function the first get_frame call will get stuck if there is no frame to get. So when the output mode is block we need to put_packet first then get_frame. Change-Id: I8cecb0e3f7b3aac2605301d6f2d35d5ca5f97756 Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
10
mpp/mpi.cpp
10
mpp/mpi.cpp
@@ -89,6 +89,7 @@ static MPP_RET mpi_decode(MppCtx ctx, MppPacket packet, MppFrame *frame)
|
|||||||
mpi_dbg_func("enter ctx %p packet %p frame %p\n", ctx, packet, frame);
|
mpi_dbg_func("enter ctx %p packet %p frame %p\n", ctx, packet, frame);
|
||||||
do {
|
do {
|
||||||
RK_U32 packet_done = 0;
|
RK_U32 packet_done = 0;
|
||||||
|
Mpp *mpp = p->ctx;
|
||||||
ret = check_mpp_ctx(p);
|
ret = check_mpp_ctx(p);
|
||||||
if (ret)
|
if (ret)
|
||||||
break;
|
break;
|
||||||
@@ -103,11 +104,14 @@ static MPP_RET mpi_decode(MppCtx ctx, MppPacket packet, MppFrame *frame)
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
/*
|
/*
|
||||||
* if there is frame to return get the frame first
|
* If there is frame to return get the frame first
|
||||||
|
* But if the output mode is block then we need to send packet first
|
||||||
*/
|
*/
|
||||||
ret = p->ctx->get_frame(frame);
|
if (!mpp->mOutputBlock || packet_done) {
|
||||||
|
ret = mpp->get_frame(frame);
|
||||||
if (ret || *frame)
|
if (ret || *frame)
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* when packet is send do one more get frame here */
|
/* when packet is send do one more get frame here */
|
||||||
if (packet_done)
|
if (packet_done)
|
||||||
@@ -116,7 +120,7 @@ static MPP_RET mpi_decode(MppCtx ctx, MppPacket packet, MppFrame *frame)
|
|||||||
/*
|
/*
|
||||||
* then send input stream with block mode
|
* then send input stream with block mode
|
||||||
*/
|
*/
|
||||||
ret = p->ctx->put_packet(packet);
|
ret = mpp->put_packet(packet);
|
||||||
if (MPP_OK == ret)
|
if (MPP_OK == ret)
|
||||||
packet_done = 1;
|
packet_done = 1;
|
||||||
} while (1);
|
} while (1);
|
||||||
|
@@ -50,6 +50,8 @@ Mpp::Mpp()
|
|||||||
mOutputPort(NULL),
|
mOutputPort(NULL),
|
||||||
mInputTaskQueue(NULL),
|
mInputTaskQueue(NULL),
|
||||||
mOutputTaskQueue(NULL),
|
mOutputTaskQueue(NULL),
|
||||||
|
mInputBlock(0),
|
||||||
|
mOutputBlock(0),
|
||||||
mThreadCodec(NULL),
|
mThreadCodec(NULL),
|
||||||
mThreadHal(NULL),
|
mThreadHal(NULL),
|
||||||
mDec(NULL),
|
mDec(NULL),
|
||||||
@@ -57,9 +59,6 @@ Mpp::Mpp()
|
|||||||
mType(MPP_CTX_BUTT),
|
mType(MPP_CTX_BUTT),
|
||||||
mCoding(MPP_VIDEO_CodingUnused),
|
mCoding(MPP_VIDEO_CodingUnused),
|
||||||
mInitDone(0),
|
mInitDone(0),
|
||||||
mPacketBlock(0),
|
|
||||||
mInputBlock(0),
|
|
||||||
mOutputBlock(0),
|
|
||||||
mMultiFrame(0),
|
mMultiFrame(0),
|
||||||
mInputTask(NULL),
|
mInputTask(NULL),
|
||||||
mStatus(0),
|
mStatus(0),
|
||||||
|
@@ -109,6 +109,8 @@ public:
|
|||||||
MppTaskQueue mInputTaskQueue;
|
MppTaskQueue mInputTaskQueue;
|
||||||
MppTaskQueue mOutputTaskQueue;
|
MppTaskQueue mOutputTaskQueue;
|
||||||
|
|
||||||
|
RK_U32 mInputBlock;
|
||||||
|
RK_U32 mOutputBlock;
|
||||||
/*
|
/*
|
||||||
* There are two threads for each decoder/encoder: codec thread and hal thread
|
* There are two threads for each decoder/encoder: codec thread and hal thread
|
||||||
*
|
*
|
||||||
@@ -131,9 +133,6 @@ private:
|
|||||||
MppCodingType mCoding;
|
MppCodingType mCoding;
|
||||||
|
|
||||||
RK_U32 mInitDone;
|
RK_U32 mInitDone;
|
||||||
RK_U32 mPacketBlock;
|
|
||||||
RK_U32 mInputBlock;
|
|
||||||
RK_U32 mOutputBlock;
|
|
||||||
RK_U32 mMultiFrame;
|
RK_U32 mMultiFrame;
|
||||||
|
|
||||||
// task for put_frame / put_packet
|
// task for put_frame / put_packet
|
||||||
|
Reference in New Issue
Block a user