@@ -622,8 +622,9 @@ void dep_decode_a_video_packet(int p_videoFileIndex) {
622
622
LOGI (10 , "got a video packet, dump dependency: %d" , p_videoFileIndex );
623
623
++ gVideoCodecCtxDepList [p_videoFileIndex ]-> dep_video_packet_num ;
624
624
/*put the video packet into the packet queue, for the decoding thread to access*/
625
- LOGI (10 , "put a video packet into queue: %d" , p_videoFileIndex );
626
- packet_queue_put (& gVideoPacketQueueList [p_videoFileIndex ], & gVideoPacketDepList [p_videoFileIndex ]);
625
+ //to save memory, don't do it
626
+ //LOGI(10, "put a video packet into queue: %d", p_videoFileIndex);
627
+ //packet_queue_put(&gVideoPacketQueueList[p_videoFileIndex], &gVideoPacketDepList[p_videoFileIndex]);
627
628
/*update the gop information if it's an I-frame
628
629
update: for every GOP, we generate a set of dependency files. It has the following advantages:
629
630
0. It avoids the overhead, and memory issue caused by opearting on big files
@@ -719,7 +720,7 @@ void dep_decode_a_video_packet(int p_videoFileIndex) {
719
720
if (gVideoCodecCtxDepList [p_videoFileIndex ]-> dump_dependency ) {
720
721
avcodec_decode_video2_dep (gVideoCodecCtxDepList [p_videoFileIndex ], l_videoFrame , & l_numOfDecodedFrames , & gVideoPacketDepList [p_videoFileIndex ]);
721
722
}
722
- // av_free_packet(&gVideoPacketDepList[p_videoFileIndex]);
723
+ av_free_packet (& gVideoPacketDepList [p_videoFileIndex ]);
723
724
break ;
724
725
} else {
725
726
//it's not a video packet
@@ -975,12 +976,12 @@ void decode_a_video_packet(int p_videoFileIndex, int _roiStH, int _roiStW, int _
975
976
/*free the packet*/
976
977
av_free_packet (& gVideoPacket );
977
978
#ifdef SELECTIVE_DECODING
978
- av_free_packet (& gVideoPacket2 );
979
+ av_free_packet (& gVideoPacket2 );
979
980
#endif
980
981
break ;
981
982
} else {
982
- //it's not a video packet
983
- LOGI (10 , "it's not a video packet, continue reading! %d != %d" , gVideoPacket .stream_index , gVideoStreamIndexList [p_videoFileIndex ]);
983
+ //it's not a video packet
984
+ LOGI (10 , "it's not a video packet, continue reading! %d != %d" , gVideoPacket .stream_index , gVideoStreamIndexList [p_videoFileIndex ]);
984
985
av_free_packet (& gVideoPacket );
985
986
}
986
987
}
@@ -994,7 +995,7 @@ int load_gop_info(FILE* p_gopRecFile, int *p_startF, int *p_endF) {
994
995
* p_startF = 0 ;
995
996
* p_endF = 0 ;
996
997
if (fgets (l_gopRecLine , 50 , p_gopRecFile ) == NULL )
997
- return -1 ;
998
+ return -1 ;
998
999
if ((l_aToken = strtok (l_gopRecLine , ":" )) != NULL )
999
1000
* p_startF = atoi (l_aToken );
1000
1001
else
@@ -1004,7 +1005,10 @@ int load_gop_info(FILE* p_gopRecFile, int *p_startF, int *p_endF) {
1004
1005
else
1005
1006
return -1 ;
1006
1007
LOGI (10 , "load gop info ends: %d-%d" , * p_startF , * p_endF );
1007
- return 0 ;
1008
+ if (* p_startF > 0 && * p_endF >= * p_startF )
1009
+ return 0 ;
1010
+ else
1011
+ return -1 ;
1008
1012
}
1009
1013
1010
1014
/*load the pre computation for a gop and also compute the inter frame dependency for a gop*/
0 commit comments