[mpp_dec]: move decoder thread to mpp_dec

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@171 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
ChenHengming
2015-08-27 08:14:26 +00:00
parent 8249f27074
commit e02cd02bec
3 changed files with 108 additions and 77 deletions

View File

@@ -21,6 +21,7 @@
#include "mpp_time.h"
#include "mpp.h"
#include "mpp_dec.h"
#include "mpp_frame_impl.h"
#include "mpp_packet.h"
#include "mpp_packet_impl.h"
@@ -83,82 +84,6 @@ void *thread_hal(void *data)
return NULL;
}
static void *thread_dec(void *data)
{
Mpp *mpp = (Mpp*)data;
MppThread *dec = mpp->mTheadCodec;
MppThread *hal = mpp->mThreadHal;
mpp_list *packets = mpp->mPackets;
mpp_list *frames = mpp->mFrames;
MppPacketImpl packet;
while (MPP_THREAD_RUNNING == dec->get_status()) {
RK_U32 packet_ready = 0;
/*
* wait for stream input
*/
dec->lock();
if (0 == packets->list_size())
dec->wait();
dec->unlock();
if (packets->list_size()) {
mpp->mPacketLock.lock();
/*
* packet will be destroyed outside, here just copy the content
*/
packets->del_at_head(&packet, sizeof(packet));
mpp->mPacketGetCount++;
packet_ready = 1;
mpp->mPacketLock.unlock();
}
if (packet_ready) {
/*
* 1. send packet data to parser
*
* parser functioin input / output
* input: packet data
* dxva output slot
* output: dxva output slot
* buffer usage informatioin
*/
// decoder->parser->parse;
/*
* 2. do buffer operation according to usage information
*
* possible case:
* a. normal case
* - wait and alloc a normal frame buffer
* b. field mode case
* - two field may reuse a same buffer, no need to alloc
* c. info change case
* - need buffer in different side, need to send a info change
* frame to hal loop.
*/
//MppBuffer buffer;
//mpp_buffer_get(mpp->mFrameGroup, &buffer, MPP_TEST_FRAME_SIZE);
/*
* 3. send dxva output information and buffer information to hal thread
* combinate video codec dxva output and buffer information
*/
// hal->wait_prev_done;
// hal->send_config;
mpp->mTasks->add_at_tail(&mpp->mTask[0], sizeof(mpp->mTask[0]));
mpp->mTaskPutCount++;
hal->signal();
}
}
return NULL;
}
static void *thread_enc(void *data)
{
Mpp *mpp = (Mpp*)data;
@@ -208,7 +133,7 @@ Mpp::Mpp(MppCtxType type, MppCodingType coding)
mPackets = new mpp_list((node_destructor)NULL);
mFrames = new mpp_list((node_destructor)mpp_frame_deinit);
mTasks = new mpp_list((node_destructor)NULL);
mTheadCodec = new MppThread(thread_dec, this);
mTheadCodec = new MppThread(mpp_dec_thread, this);
mThreadHal = new MppThread(thread_hal, this);
mTask = mpp_malloc(MppHalDecTask*, mTaskNum);
mpp_buffer_group_normal_get(&mPacketGroup, MPP_BUFFER_TYPE_NORMAL);