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

Side by Side Diff: media/filters/ffmpeg_audio_decoder.cc

Issue 1041353002: media-internals: Differentiate error, info, and debug log messages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address reviewer comments Created 5 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/filters/ffmpeg_audio_decoder.h" 5 #include "media/filters/ffmpeg_audio_decoder.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "media/base/audio_buffer.h" 9 #include "media/base/audio_buffer.h"
10 #include "media/base/audio_bus.h" 10 #include "media/base/audio_bus.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 int frame_decoded = 0; 256 int frame_decoded = 0;
257 const int result = avcodec_decode_audio4( 257 const int result = avcodec_decode_audio4(
258 codec_context_.get(), av_frame_.get(), &frame_decoded, &packet); 258 codec_context_.get(), av_frame_.get(), &frame_decoded, &packet);
259 259
260 if (result < 0) { 260 if (result < 0) {
261 DCHECK(!buffer->end_of_stream()) 261 DCHECK(!buffer->end_of_stream())
262 << "End of stream buffer produced an error! " 262 << "End of stream buffer produced an error! "
263 << "This is quite possibly a bug in the audio decoder not handling " 263 << "This is quite possibly a bug in the audio decoder not handling "
264 << "end of stream AVPackets correctly."; 264 << "end of stream AVPackets correctly.";
265 265
266 MEDIA_LOG(log_cb_) 266 MEDIA_LOG(DEBUG, log_cb_)
267 << "Dropping audio frame which failed decode with timestamp: " 267 << "Dropping audio frame which failed decode with timestamp: "
268 << buffer->timestamp().InMicroseconds() << " us, duration: " 268 << buffer->timestamp().InMicroseconds()
269 << buffer->duration().InMicroseconds() << " us, packet size: " 269 << " us, duration: " << buffer->duration().InMicroseconds()
270 << buffer->data_size() << " bytes"; 270 << " us, packet size: " << buffer->data_size() << " bytes";
271 271
272 break; 272 break;
273 } 273 }
274 274
275 // Update packet size and data pointer in case we need to call the decoder 275 // Update packet size and data pointer in case we need to call the decoder
276 // with the remaining bytes from this packet. 276 // with the remaining bytes from this packet.
277 packet.size -= result; 277 packet.size -= result;
278 packet.data += result; 278 packet.data += result;
279 279
280 scoped_refptr<AudioBuffer> output; 280 scoped_refptr<AudioBuffer> output;
281 const int channels = DetermineChannels(av_frame_.get()); 281 const int channels = DetermineChannels(av_frame_.get());
282 if (frame_decoded) { 282 if (frame_decoded) {
283 if (av_frame_->sample_rate != config_.samples_per_second() || 283 if (av_frame_->sample_rate != config_.samples_per_second() ||
284 channels != ChannelLayoutToChannelCount(config_.channel_layout()) || 284 channels != ChannelLayoutToChannelCount(config_.channel_layout()) ||
285 av_frame_->format != av_sample_format_) { 285 av_frame_->format != av_sample_format_) {
286 DLOG(ERROR) << "Unsupported midstream configuration change!" 286 DLOG(ERROR) << "Unsupported midstream configuration change!"
287 << " Sample Rate: " << av_frame_->sample_rate << " vs " 287 << " Sample Rate: " << av_frame_->sample_rate << " vs "
288 << config_.samples_per_second() 288 << config_.samples_per_second()
289 << ", Channels: " << channels << " vs " 289 << ", Channels: " << channels << " vs "
290 << ChannelLayoutToChannelCount(config_.channel_layout()) 290 << ChannelLayoutToChannelCount(config_.channel_layout())
291 << ", Sample Format: " << av_frame_->format << " vs " 291 << ", Sample Format: " << av_frame_->format << " vs "
292 << av_sample_format_; 292 << av_sample_format_;
293 293
294 if (config_.codec() == kCodecAAC && 294 if (config_.codec() == kCodecAAC &&
295 av_frame_->sample_rate == 2 * config_.samples_per_second()) { 295 av_frame_->sample_rate == 2 * config_.samples_per_second()) {
296 MEDIA_LOG(log_cb_) << "Implicit HE-AAC signalling is being used." 296 MEDIA_LOG(DEBUG, log_cb_) << "Implicit HE-AAC signalling is being"
297 << " Please use mp4a.40.5 instead of mp4a.40.2 in" 297 << " used. Please use mp4a.40.5 instead of"
298 << " the mimetype."; 298 << " mp4a.40.2 in the mimetype.";
299 } 299 }
300 // This is an unrecoverable error, so bail out. 300 // This is an unrecoverable error, so bail out.
301 av_frame_unref(av_frame_.get()); 301 av_frame_unref(av_frame_.get());
302 return false; 302 return false;
303 } 303 }
304 304
305 // Get the AudioBuffer that the data was decoded into. Adjust the number 305 // Get the AudioBuffer that the data was decoded into. Adjust the number
306 // of frames, in case fewer than requested were actually decoded. 306 // of frames, in case fewer than requested were actually decoded.
307 output = reinterpret_cast<AudioBuffer*>( 307 output = reinterpret_cast<AudioBuffer*>(
308 av_buffer_get_opaque(av_frame_->buf[0])); 308 av_buffer_get_opaque(av_frame_->buf[0]));
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 388
389 ResetTimestampState(); 389 ResetTimestampState();
390 return true; 390 return true;
391 } 391 }
392 392
393 void FFmpegAudioDecoder::ResetTimestampState() { 393 void FFmpegAudioDecoder::ResetTimestampState() {
394 discard_helper_->Reset(config_.codec_delay()); 394 discard_helper_->Reset(config_.codec_delay());
395 } 395 }
396 396
397 } // namespace media 397 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698