Commit 6042f34b2b21e9eac2ce8588c5758b6f1e7f788b
1 parent
42424bf2
代码优化
Showing
2 changed files
with
12 additions
and
17 deletions
src/demo/main_dvpp.cpp
src/dvpp/DvppDec.cpp
@@ -129,21 +129,14 @@ static void *ReportThd(void *arg) | @@ -129,21 +129,14 @@ static void *ReportThd(void *arg) | ||
129 | } | 129 | } |
130 | 130 | ||
131 | void DvppDec::doProcessReport(){ | 131 | void DvppDec::doProcessReport(){ |
132 | - // aclrtContext thdContext = nullptr; | ||
133 | - // CHECK_AND_RETURN_NOVALUE(aclrtCreateContext(&thdContext, m_dvpp_deviceId), "aclrtCreateContext failed"); | ||
134 | 132 | ||
135 | CHECK_AND_RETURN_NOVALUE(aclrtSetCurrentContext(m_context), "aclrtSetCurrentContext failed"); | 133 | CHECK_AND_RETURN_NOVALUE(aclrtSetCurrentContext(m_context), "aclrtSetCurrentContext failed"); |
136 | // 阻塞等待vdec线程开始 | 134 | // 阻塞等待vdec线程开始 |
137 | 135 | ||
138 | int ret; | 136 | int ret; |
139 | while (!m_bExitReportThd) { | 137 | while (!m_bExitReportThd) { |
140 | - ret = aclrtProcessReport(1000); | ||
141 | - if (ret != ACL_ERROR_NONE) { | ||
142 | - cout << "device: " << m_dvpp_deviceId << ", chn: " << m_dvpp_channel << ", aclrtProcessReport failed, ret: " << ret << endl; | ||
143 | - } | 138 | + aclrtProcessReport(1000); |
144 | } | 139 | } |
145 | - | ||
146 | - // CHECK_AND_RETURN_NOVALUE(aclrtDestroyContext(thdContext), "aclrtDestroyContext failed"); | ||
147 | } | 140 | } |
148 | 141 | ||
149 | static int count_frame = 0; | 142 | static int count_frame = 0; |
@@ -192,7 +185,7 @@ void DvppDec::doVdppVdecCallBack(acldvppStreamDesc *input, acldvppPicDesc *outpu | @@ -192,7 +185,7 @@ void DvppDec::doVdppVdecCallBack(acldvppStreamDesc *input, acldvppPicDesc *outpu | ||
192 | // 保存vdec结果 | 185 | // 保存vdec结果 |
193 | if(count_frame > 45 && count_frame < 50) | 186 | if(count_frame > 45 && count_frame < 50) |
194 | { | 187 | { |
195 | - string file_name = "./yuv_pic/vdec_out"+ m_dec_name +".rgb" ; | 188 | + string file_name = "./yuv_pic/vdec_out_"+ m_dec_name +".rgb" ; |
196 | FILE *outputFile = fopen(file_name.c_str(), "a"); | 189 | FILE *outputFile = fopen(file_name.c_str(), "a"); |
197 | if(outputFile){ | 190 | if(outputFile){ |
198 | fwrite(vdecHostAddr, data_size, sizeof(char), outputFile); | 191 | fwrite(vdecHostAddr, data_size, sizeof(char), outputFile); |
@@ -398,23 +391,24 @@ int DvppDec::sentFrame(aclvdecChannelDesc *vdecChannelDesc, uint64_t frame_count | @@ -398,23 +391,24 @@ int DvppDec::sentFrame(aclvdecChannelDesc *vdecChannelDesc, uint64_t frame_count | ||
398 | // user_data->startTime = startTime; | 391 | // user_data->startTime = startTime; |
399 | user_data->sendTime = UtilTools::get_cur_time_ms(); | 392 | user_data->sendTime = UtilTools::get_cur_time_ms(); |
400 | user_data->self = this; | 393 | user_data->self = this; |
401 | - // user_data->inBufNode = bufNode; | ||
402 | - cout << "send frame" << endl; | ||
403 | - CHECK_NOT_RETURN(aclvdecSendFrame(vdecChannelDesc, input_stream_desc, output_pic_desc, nullptr, reinterpret_cast<void *>(user_data)), | ||
404 | - "aclvdecSendFrame failed"); | 394 | + |
395 | + ret = aclvdecSendFrame(vdecChannelDesc, input_stream_desc, output_pic_desc, nullptr, reinterpret_cast<void *>(user_data)); | ||
396 | + if(ret != ACL_ERROR_NONE){ | ||
397 | + cout << "aclvdecSendFrame failed" << endl; | ||
398 | + m_pktQueueptr->addHead(); | ||
399 | + av_packet_unref(pkt); | ||
400 | + break; | ||
401 | + } | ||
405 | 402 | ||
406 | m_vdecQueue.addTail(); | 403 | m_vdecQueue.addTail(); |
407 | 404 | ||
408 | - m_pktQueueptr->addHead(); | ||
409 | - av_packet_unref(pkt); | ||
410 | - | ||
411 | return 0; | 405 | return 0; |
412 | }while (0); | 406 | }while (0); |
413 | 407 | ||
414 | if(input_stream_desc){ | 408 | if(input_stream_desc){ |
415 | CHECK_NOT_RETURN(acldvppDestroyStreamDesc(input_stream_desc), "acldvppDestroyStreamDesc failed"); | 409 | CHECK_NOT_RETURN(acldvppDestroyStreamDesc(input_stream_desc), "acldvppDestroyStreamDesc failed"); |
416 | } | 410 | } |
417 | - if(output_pic_desc){ | 411 | + if(output_pic_desc){ |
418 | CHECK_NOT_RETURN(acldvppDestroyPicDesc(output_pic_desc), "acldvppDestroyPicDesc failed"); | 412 | CHECK_NOT_RETURN(acldvppDestroyPicDesc(output_pic_desc), "acldvppDestroyPicDesc failed"); |
419 | } | 413 | } |
420 | 414 |