Cleaned up resource leaks.
BUG=C-10059, C-10228, C-10229. Review URL: https://webrtc-codereview.appspot.com/345013 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1439 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -43,6 +43,7 @@ int ViEFileImage::ConvertJPEGToVideoFrame(int engine_id,
|
|||||||
image_buffer._size, image_file)) {
|
image_buffer._size, image_file)) {
|
||||||
WEBRTC_TRACE(kTraceError, kTraceVideo, engine_id,
|
WEBRTC_TRACE(kTraceError, kTraceVideo, engine_id,
|
||||||
"%s could not read file %s", __FUNCTION__, file_nameUTF8);
|
"%s could not read file %s", __FUNCTION__, file_nameUTF8);
|
||||||
|
fclose(image_file);
|
||||||
delete [] image_buffer._buffer;
|
delete [] image_buffer._buffer;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@@ -949,7 +949,7 @@ VideoFrame& video_frame) {
|
|||||||
|
|
||||||
ViECaptureSnapshot::ViECaptureSnapshot()
|
ViECaptureSnapshot::ViECaptureSnapshot()
|
||||||
: crit_(CriticalSectionWrapper::CreateCriticalSection()),
|
: crit_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||||
condition_varaible_(*ConditionVariableWrapper::CreateConditionVariable()),
|
condition_varaible_(ConditionVariableWrapper::CreateConditionVariable()),
|
||||||
video_frame_(NULL) {
|
video_frame_(NULL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -964,7 +964,7 @@ bool ViECaptureSnapshot::GetSnapshot(VideoFrame& video_frame,
|
|||||||
unsigned int max_wait_time) {
|
unsigned int max_wait_time) {
|
||||||
crit_->Enter();
|
crit_->Enter();
|
||||||
video_frame_ = new VideoFrame();
|
video_frame_ = new VideoFrame();
|
||||||
if (condition_varaible_.SleepCS(*(crit_.get()), max_wait_time)) {
|
if (condition_varaible_->SleepCS(*(crit_.get()), max_wait_time)) {
|
||||||
// Snapshot taken.
|
// Snapshot taken.
|
||||||
video_frame.SwapFrame(*video_frame_);
|
video_frame.SwapFrame(*video_frame_);
|
||||||
delete video_frame_;
|
delete video_frame_;
|
||||||
@@ -984,7 +984,7 @@ const WebRtc_UWord32 CSRC[kRtpCsrcSize]) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
video_frame_->SwapFrame(video_frame);
|
video_frame_->SwapFrame(video_frame);
|
||||||
condition_varaible_.WakeAll();
|
condition_varaible_->WakeAll();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -43,7 +43,7 @@ class ViECaptureSnapshot : public ViEFrameCallback {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
scoped_ptr<CriticalSectionWrapper> crit_;
|
scoped_ptr<CriticalSectionWrapper> crit_;
|
||||||
ConditionVariableWrapper& condition_varaible_;
|
scoped_ptr<ConditionVariableWrapper> condition_varaible_;
|
||||||
VideoFrame* video_frame_;
|
VideoFrame* video_frame_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -354,6 +354,7 @@ int ViENetworkImpl::GetLocalIP(char ip_address[64], bool ipv6) {
|
|||||||
if (ipv6) {
|
if (ipv6) {
|
||||||
WebRtc_UWord8 local_ip[16];
|
WebRtc_UWord8 local_ip[16];
|
||||||
if (socket_transport->LocalHostAddressIPV6(local_ip) != 0) {
|
if (socket_transport->LocalHostAddressIPV6(local_ip) != 0) {
|
||||||
|
UdpTransport::Destroy(socket_transport);
|
||||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_),
|
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_),
|
||||||
"%s: Could not get local IP", __FUNCTION__);
|
"%s: Could not get local IP", __FUNCTION__);
|
||||||
SetLastError(kViENetworkUnknownError);
|
SetLastError(kViENetworkUnknownError);
|
||||||
@@ -370,6 +371,7 @@ int ViENetworkImpl::GetLocalIP(char ip_address[64], bool ipv6) {
|
|||||||
} else {
|
} else {
|
||||||
WebRtc_UWord32 local_ip = 0;
|
WebRtc_UWord32 local_ip = 0;
|
||||||
if (socket_transport->LocalHostAddress(local_ip) != 0) {
|
if (socket_transport->LocalHostAddress(local_ip) != 0) {
|
||||||
|
UdpTransport::Destroy(socket_transport);
|
||||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_),
|
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_),
|
||||||
"%s: Could not get local IP", __FUNCTION__);
|
"%s: Could not get local IP", __FUNCTION__);
|
||||||
SetLastError(kViENetworkUnknownError);
|
SetLastError(kViENetworkUnknownError);
|
||||||
|
Reference in New Issue
Block a user