Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Unified Diff: media/filters/audio_file_reader.cc

Issue 10821029: Moved DCHECK() to prevent NULL deref of codec_context_. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Eliminated code Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/audio_file_reader.cc
diff --git a/media/filters/audio_file_reader.cc b/media/filters/audio_file_reader.cc
index 706a9aac45b727c18c7639b7905e7543a68c102a..ccfafa101a4957702e9595828dbbd3c6f723c465 100644
--- a/media/filters/audio_file_reader.cc
+++ b/media/filters/audio_file_reader.cc
@@ -112,17 +112,14 @@ void AudioFileReader::Close() {
bool AudioFileReader::Read(const std::vector<float*>& audio_data,
size_t number_of_frames) {
+ DCHECK(format_context_ && codec_context_ && codec_) <<
+ "AudioFileReader::Read() : reader is not opened!";
+
size_t channels = this->channels();
DCHECK_EQ(audio_data.size(), channels);
if (audio_data.size() != channels)
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.
scoped_ptr_malloc<AVFrame, ScopedPtrAVFree> av_frame(avcodec_alloc_frame());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698