aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorprasanth kamuju <prasanth.kamuju@linaro.org>2014-06-16 12:31:44 +0530
committerprasanth kamuju <prasanth.kamuju@linaro.org>2014-06-16 12:31:44 +0530
commit1b0b934ad1ae964697f52d7bfcbbb40946646f68 (patch)
tree9b05fb329c5cc3acc62edddc9864033f0842a2e0
parent6e9475e4ff1fc79befd5cb6cb72b2fb85ff928af (diff)
downloadvpb-1b0b934ad1ae964697f52d7bfcbbb40946646f68.tar.gz
Fix for the segmentation fault and added few more logs.
Correct the output buffer address before free and added few more meaning full logs for debug purpose.
-rw-r--r--decoder_driver_test.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/decoder_driver_test.c b/decoder_driver_test.c
index 50eee3d..935a9ab 100644
--- a/decoder_driver_test.c
+++ b/decoder_driver_test.c
@@ -159,10 +159,15 @@ int main (int argc, char **argv)
DEBUG_PRINT("\n Error in stop decoding call");
error = -1;
}
+
+ DEBUG_PRINT("\n waiting for threads to join \n");
+ pthread_join( decoder_context->asyncthread_id, NULL);
+ pthread_join( decoder_context->videothread_id, NULL);
+ DEBUG_PRINT("\n Threads are finished with proce\n");
if (error != -1)
{
- DEBUG_PRINT ("\n\n >>>>> Total Number of frames decoded %d\n",total_frames);
+ DEBUG_PRINT ("\n\n Total Number of frames decoded %d\n",total_frames);
/* Decoding is completed,now we need to de-initialize the decoder */
DEBUG_PRINT("\n De-init the decoder Enter");
@@ -173,6 +178,7 @@ int main (int argc, char **argv)
(void)free_buffer (VDEC_BUFFER_TYPE_INPUT,decoder_context);
(void)free_buffer (VDEC_BUFFER_TYPE_OUTPUT,decoder_context);
+ DEBUG_PRINT("\n input & output buffers free completed \n");
if (decoder_context->inputBufferFile != NULL)
{
fclose (decoder_context->inputBufferFile);
@@ -181,6 +187,9 @@ int main (int argc, char **argv)
{
fclose (decoder_context->outputBufferFile);
}
+ DEBUG_PRINT("\n input and output files are closed video_decoder is going to close \n");
+ close (decoder_context->video_driver_fd);
+ DEBUG_PRINT("\n free the decoder_context and return \n");
free(decoder_context);
}
return error;
@@ -382,28 +391,28 @@ int free_buffer ( enum vdec_buffer buffer_dir,
else if ( buffer_dir == VDEC_BUFFER_TYPE_OUTPUT )
{
buffercount = decode_context->output_buffer.actualcount;
- ptemp = (struct vdec_bufferpayload*)&decode_context->ptr_outputbuffer;
+ ptemp = decode_context->ptr_outputbuffer;
- if (decode_context->ptr_respbuffer)
- {
- free (decode_context->ptr_respbuffer);
- decode_context->ptr_respbuffer = NULL;
- }
- if (ptemp)
+ for (i=0;i<buffercount;i++)
{
- for (i=0;i<buffercount;i++)
- {
if (ptemp [i].pmem_fd != -1)
{
munmap ( ptemp [i].bufferaddr,ptemp [i].mmaped_size);
ptemp [i].bufferaddr = NULL;
close (ptemp [i].pmem_fd);
}
- }
- free (ptemp);
+ }
+ if (decode_context->ptr_respbuffer)
+ {
+ free (decode_context->ptr_respbuffer);
+ decode_context->ptr_respbuffer = NULL;
+ }
+ if(decode_context->ptr_outputbuffer)
+ {
+ free (decode_context->ptr_outputbuffer);
decode_context->ptr_outputbuffer = NULL;
- }
+ }
}
return 1;
@@ -768,11 +777,6 @@ int deinit_decoder (struct video_decoder_context *init_decode)
return -1;
}
- /*Close the driver*/
- if (init_decode->video_driver_fd != -1)
- {
- close (init_decode->video_driver_fd);
- }
if (init_decode->queue_context.ptr_cmdq)
{
free (init_decode->queue_context.ptr_cmdq);