Skip to content

Commit

Permalink
cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
Consti10 committed Apr 30, 2024
1 parent f8ca175 commit f1358e9
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions host_applications/linux/apps/hello_pi/hello_video/fpv_video0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ void configure_x20(OMX_BUFFERHEADERTYPE *buf){
}
}

void util_drop_buffer(OMX_BUFFERHEADERTYPE *buf){
buf->nFilledLen = 0;
buf->nOffset = 0;
if (OMX_EmptyThisBuffer(ILC_GET_HANDLE(video_decode), buf) != OMX_ErrorNone) {
fprintf(stderr, "Cannot give buffer back\n");
}
}

uint64_t first_frame_ms=0;
bool air_unit_discovery_finished= false;
bool insert_eof= false;
Expand Down Expand Up @@ -298,8 +306,7 @@ static int video_decode_test(FILE* in) {
first_frame_ms=get_time_ms();
// Skip this frame
// Don't forget to give buffer back
buf->nFilledLen = data_len;
OMX_EmptyThisBuffer(ILC_GET_HANDLE(video_decode), buf);
util_drop_buffer(buf);
continue;
}else{
const auto elapsed=get_time_ms()-first_frame_ms;
Expand All @@ -309,9 +316,7 @@ static int video_decode_test(FILE* in) {
air_unit_discovery_finished= true;
}else{
// Skip this frame
// Don't forget to give buffer back
buf->nFilledLen = data_len;
OMX_EmptyThisBuffer(ILC_GET_HANDLE(video_decode), buf);
util_drop_buffer(buf);
continue;
}
}
Expand Down

0 comments on commit f1358e9

Please sign in to comment.