提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
经过测试,使用rtsp+mpp+rga取流1920*1080图像一帧耗时60ms左右,基本可满足要求
一、mpp解码
void decoder_routine(QImage &img,bool &bOK)
{
int ret;
RK_U32 pkt_done = 0;
// write data to packet
mpp_packet_write(packet, 0, packet_buffer, packet_wpos);
// reset pos and set valid length
mpp_packet_set_pos(packet, packet_buffer);
mpp_packet_set_length(packet, packet_wpos);
// printf("packet_wpos = :%d\n",packet_wpos);
packet_wpos = 0;
// setup eos flag
if (pkt_eos)
mpp_packet_set_eos(packet);
do {
RK_S32 times = 5;
// send the packet first if packet is not done
if (!pkt_done)
{
ret = mpi->decode_put_packet(ctx, packet);
if (MPP_OK == ret)
pkt_done = 1;
}
// then get all available frame and release
do {
RK_S32 get_frm = 0;
RK_U32 frm_eos = 0;
try_again:
ret = mpi->decode_get_frame(ctx, &frame);
if (MPP_ERR_TIMEOUT == ret) {
if (times > 0) {
times--;
msleep(MPP_H264_DECODE_TIMEOUT);
goto try_again;
}
mpp_err("decode_get_frame failed too much time\n");
}
if (MPP_OK != ret) {
mpp_err("decode_get_frame failed ret %d\n", ret);
break;
}
if (frame) {
if (mpp_frame_get_info_change(frame))
{
RK_U32 width = mpp_frame_get_width
487




被折叠的 条评论
为什么被折叠?



