Moved DCHECK() to prevent NULL deref of codec_context_.

CID=102266
BUG=
TEST=
TBR=annacc

Review URL: https://chromiumcodereview.appspot.com/10821029

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148691 0039d316-1c4b-4281-b951-d872f2087c98
parent 474e4dc5
...@@ -112,17 +112,14 @@ void AudioFileReader::Close() { ...@@ -112,17 +112,14 @@ void AudioFileReader::Close() {
bool AudioFileReader::Read(const std::vector<float*>& audio_data, bool AudioFileReader::Read(const std::vector<float*>& audio_data,
size_t number_of_frames) { size_t number_of_frames) {
DCHECK(format_context_ && codec_context_ && codec_) <<
"AudioFileReader::Read() : reader is not opened!";
size_t channels = this->channels(); size_t channels = this->channels();
DCHECK_EQ(audio_data.size(), channels); DCHECK_EQ(audio_data.size(), channels);
if (audio_data.size() != channels) if (audio_data.size() != channels)
return false; return false;
DCHECK(format_context_ && codec_context_ && codec_);
if (!format_context_ || !codec_context_ || !codec_) {
DLOG(WARNING) << "AudioFileReader::Read() : reader is not opened!";
return false;
}
// Holds decoded audio. // Holds decoded audio.
scoped_ptr_malloc<AVFrame, ScopedPtrAVFree> av_frame(avcodec_alloc_frame()); scoped_ptr_malloc<AVFrame, ScopedPtrAVFree> av_frame(avcodec_alloc_frame());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment