mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-07 01:52:46 +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);
|
||||
do {
|
||||
RK_U32 packet_done = 0;
|
||||
Mpp *mpp = p->ctx;
|
||||
ret = check_mpp_ctx(p);
|
||||
if (ret)
|
||||
break;
|
||||
@@ -103,11 +104,14 @@ static MPP_RET mpi_decode(MppCtx ctx, MppPacket packet, MppFrame *frame)
|
||||
|
||||
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)
|
||||
break;
|
||||
}
|
||||
|
||||
/* when packet is send do one more get frame here */
|
||||
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
|
||||
*/
|
||||
ret = p->ctx->put_packet(packet);
|
||||
ret = mpp->put_packet(packet);
|
||||
if (MPP_OK == ret)
|
||||
packet_done = 1;
|
||||
} while (1);
|
||||
|
@@ -50,6 +50,8 @@ Mpp::Mpp()
|
||||
mOutputPort(NULL),
|
||||
mInputTaskQueue(NULL),
|
||||
mOutputTaskQueue(NULL),
|
||||
mInputBlock(0),
|
||||
mOutputBlock(0),
|
||||
mThreadCodec(NULL),
|
||||
mThreadHal(NULL),
|
||||
mDec(NULL),
|
||||
@@ -57,9 +59,6 @@ Mpp::Mpp()
|
||||
mType(MPP_CTX_BUTT),
|
||||
mCoding(MPP_VIDEO_CodingUnused),
|
||||
mInitDone(0),
|
||||
mPacketBlock(0),
|
||||
mInputBlock(0),
|
||||
mOutputBlock(0),
|
||||
mMultiFrame(0),
|
||||
mInputTask(NULL),
|
||||
mStatus(0),
|
||||
|
@@ -109,6 +109,8 @@ public:
|
||||
MppTaskQueue mInputTaskQueue;
|
||||
MppTaskQueue mOutputTaskQueue;
|
||||
|
||||
RK_U32 mInputBlock;
|
||||
RK_U32 mOutputBlock;
|
||||
/*
|
||||
* There are two threads for each decoder/encoder: codec thread and hal thread
|
||||
*
|
||||
@@ -131,9 +133,6 @@ private:
|
||||
MppCodingType mCoding;
|
||||
|
||||
RK_U32 mInitDone;
|
||||
RK_U32 mPacketBlock;
|
||||
RK_U32 mInputBlock;
|
||||
RK_U32 mOutputBlock;
|
||||
RK_U32 mMultiFrame;
|
||||
|
||||
// task for put_frame / put_packet
|
||||
|
Reference in New Issue
Block a user