Skip to content

Commit 5c788e3

Browse files
author
Clement Champetier
committed
decoded data: raise a bad_alloc when faling to allocate the requested space
1 parent 7e20933 commit 5c788e3

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/AvTranscoder/data/decoded/AudioFrame.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ void AudioFrame::allocateData()
110110
os << "channel layout = " << av_get_channel_name(_frame->channels) << ", ";
111111
os << "nb samples = " << _frame->nb_samples << ", ";
112112
os << "sample format = " << getSampleFormatName(_desc._sampleFormat);
113-
throw std::runtime_error(os.str());
113+
LOG_ERROR(os.str())
114+
throw std::bad_alloc();
114115
}
115116
_dataAllocated = true;
116117
}

src/AvTranscoder/data/decoded/Frame.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ void Frame::allocateAVFrame()
4040
#endif
4141
if(_frame == NULL)
4242
{
43-
throw std::runtime_error("Unable to allocate an empty Frame.");
43+
LOG_ERROR("Unable to allocate an empty Frame.")
44+
throw std::bad_alloc();
4445
}
4546
}
4647

src/AvTranscoder/data/decoded/VideoFrame.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ void VideoFrame::allocateData()
9393
os << "width = " << _frame->width << ", ";
9494
os << "height = " << _frame->height << ", ";
9595
os << "pixel format = " << getPixelFormatName(_desc._pixelFormat);
96-
throw std::runtime_error(os.str());
96+
LOG_ERROR(os.str())
97+
throw std::bad_alloc();
9798
}
9899
_dataAllocated = true;
99100
}

0 commit comments

Comments
 (0)