Skip to content

Commit cd2db7b

Browse files
author
Clement Champetier
committed
frames: add log to warn about possible data already allocated
1 parent 1cea044 commit cd2db7b

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/AvTranscoder/data/decoded/AudioFrame.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ size_t AudioFrame::getDataSize() const
9898

9999
void AudioFrame::allocateData()
100100
{
101+
if(_dataAllocated)
102+
LOG_WARN("The AudioFrame seems to already have allocated data. This could lead to memory leaks.")
103+
101104
// Set Frame properties
102105
av_frame_set_sample_rate(_frame, _desc._sampleRate);
103106
av_frame_set_channels(_frame, _desc._nbChannels);

src/AvTranscoder/data/decoded/VideoFrame.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ size_t VideoFrame::getDataSize() const
8383

8484
void VideoFrame::allocateData()
8585
{
86+
if(_dataAllocated)
87+
LOG_WARN("The VideoFrame seems to already have allocated data. This could lead to memory leaks.")
88+
8689
// Set Frame properties
8790
_frame->width = _desc._width;
8891
_frame->height = _desc._height;

0 commit comments

Comments
 (0)