[mpp]: add frame signal chain to mpp parser/hal thread and get_frame interface

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@254 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
ChenHengming
2015-09-09 16:04:33 +00:00
parent 7cc518a721
commit 3f1100ca08
4 changed files with 18 additions and 1 deletions

View File

@@ -260,6 +260,7 @@ void *mpp_dec_hal_thread(void *data)
frames->lock();
frames->add_at_tail(&frame, sizeof(frame));
mpp->mFramePutCount++;
frames->signal();
frames->unlock();
}

View File

@@ -108,6 +108,7 @@ void *mpp_enc_hal_thread(void *data)
frames->lock();
frames->add_at_tail(&frame, sizeof(frame));
mpp->mFramePutCount++;
frames->signal();
frames->unlock();
}
}

View File

@@ -168,20 +168,27 @@ MPP_RET Mpp::get_frame(MppFrame *frame)
{
Mutex::Autolock autoLock(mFrames->mutex());
MppFrame first = NULL;
if (0 == mFrames->list_size()) {
mThreadCodec->signal();
mFrames->wait();
}
if (mFrames->list_size()) {
mFrames->del_at_tail(&first, sizeof(frame));
mFrameGetCount++;
mThreadHal->signal();
MppFrame prev = first;
MppFrame next = NULL;
while (mFrames->list_size()) {
mFrames->del_at_tail(&next, sizeof(frame));
mFrameGetCount++;
mThreadHal->signal();
mpp_frame_set_next(prev, next);
prev = next;
}
}
mThreadHal->signal();
*frame = first;
return MPP_OK;
}

View File

@@ -82,6 +82,10 @@ int main()
for (i = 0; i < MPI_DEC_LOOP_COUNT; i++) {
mpp_packet_init(&dec_in, buf, size);
// IMPORTANT: eos flag will flush all decoded frame
if (i == MPI_DEC_LOOP_COUNT - 1)
mpp_packet_set_eos(dec_in);
// TODO: read stream data to buf
ret = mpi->decode(ctx, dec_in, &dec_out);
@@ -108,6 +112,10 @@ int main()
for (i = 0; i < MPI_DEC_LOOP_COUNT; i++) {
mpp_packet_init(&dec_in, buf, size);
// IMPORTANT: eos flag will flush all decoded frame
if (i == MPI_DEC_LOOP_COUNT - 1)
mpp_packet_set_eos(dec_in);
// TODO: read stream data to buf
ret = mpi->decode_put_packet(ctx, dec_in);