cleanup av_packet_unref/free_packet by using our zm_av_packet_unref

This commit is contained in:
Isaac Connor 2017-01-11 14:22:37 -05:00
parent 0d5910644e
commit 8653822bff
1 changed files with 4 additions and 16 deletions

View File

@ -378,11 +378,7 @@ int RemoteCameraRtsp::Capture( Image &image ) {
} /* frame complete */ } /* frame complete */
#if LIBAVCODEC_VERSION_CHECK(57, 8, 0, 12, 100) zm_av_packet_unref( &packet );
av_packet_unref( &packet );
#else
av_free_packet( &packet );
#endif
} /* getFrame() */ } /* getFrame() */
if(frameComplete) if(frameComplete)
@ -526,7 +522,7 @@ int RemoteCameraRtsp::CaptureAndRecord(Image &image, bool recording, char* event
int ret = videoStore->writeVideoFramePacket(&packet);//, &lastKeyframePkt); int ret = videoStore->writeVideoFramePacket(&packet);//, &lastKeyframePkt);
if ( ret < 0 ) {//Less than zero and we skipped a frame if ( ret < 0 ) {//Less than zero and we skipped a frame
// Should not // Should not
av_free_packet( &packet ); zm_av_packet_unref( &packet );
return 0; return 0;
} }
} // end if videoStore, so we are recording } // end if videoStore, so we are recording
@ -555,21 +551,13 @@ int RemoteCameraRtsp::CaptureAndRecord(Image &image, bool recording, char* event
//Write the packet to our video store //Write the packet to our video store
int ret = videoStore->writeAudioFramePacket( &packet ); //FIXME no relevance of last key frame int ret = videoStore->writeAudioFramePacket( &packet ); //FIXME no relevance of last key frame
if ( ret < 0 ) { //Less than zero and we skipped a frame if ( ret < 0 ) { //Less than zero and we skipped a frame
#if LIBAVCODEC_VERSION_CHECK(57, 8, 0, 12, 100) zm_av_packet_unref( &packet );
av_packet_unref( &packet );
#else
av_free_packet( &packet );
#endif
return 0; return 0;
} }
} }
} // end if video or audio packet } // end if video or audio packet
#if LIBAVCODEC_VERSION_CHECK(57, 8, 0, 12, 100) zm_av_packet_unref( &packet );
av_packet_unref( &packet );
#else
av_free_packet( &packet );
#endif
} // end while ! framecomplete and buffer.size() } // end while ! framecomplete and buffer.size()
if(frameComplete) if(frameComplete)
return (0); return (0);