| OLD | NEW |
| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 // Currently Vorbis is the only codec that causes us to drop samples. | 389 // Currently Vorbis is the only codec that causes us to drop samples. |
| 390 // If we have to drop samples it always means the timeline starts at 0. | 390 // If we have to drop samples it always means the timeline starts at 0. |
| 391 DCHECK_EQ(codec_context_->codec_id, AV_CODEC_ID_VORBIS); | 391 DCHECK_EQ(codec_context_->codec_id, AV_CODEC_ID_VORBIS); |
| 392 output_timestamp_helper_->SetBaseTimestamp(base::TimeDelta()); | 392 output_timestamp_helper_->SetBaseTimestamp(base::TimeDelta()); |
| 393 } else { | 393 } else { |
| 394 output_timestamp_helper_->SetBaseTimestamp(input->GetTimestamp()); | 394 output_timestamp_helper_->SetBaseTimestamp(input->GetTimestamp()); |
| 395 } | 395 } |
| 396 } | 396 } |
| 397 | 397 |
| 398 int decoded_audio_size = 0; | 398 int decoded_audio_size = 0; |
| 399 #ifdef CHROMIUM_NO_AVFRAME_CHANNELS |
| 400 int channels = av_get_channel_layout_nb_channels( |
| 401 av_frame_->channel_layout); |
| 402 #else |
| 403 int channels = av_frame_->channels; |
| 404 #endif |
| 399 if (frame_decoded) { | 405 if (frame_decoded) { |
| 400 if (av_frame_->sample_rate != samples_per_second_ || | 406 if (av_frame_->sample_rate != samples_per_second_ || |
| 401 av_frame_->channels != channels_ || | 407 channels != channels_ || |
| 402 av_frame_->format != av_sample_format_) { | 408 av_frame_->format != av_sample_format_) { |
| 403 DLOG(ERROR) << "Unsupported midstream configuration change!" | 409 DLOG(ERROR) << "Unsupported midstream configuration change!" |
| 404 << " Sample Rate: " << av_frame_->sample_rate << " vs " | 410 << " Sample Rate: " << av_frame_->sample_rate << " vs " |
| 405 << samples_per_second_ | 411 << samples_per_second_ |
| 406 << ", Channels: " << av_frame_->channels << " vs " | 412 << ", Channels: " << channels << " vs " |
| 407 << channels_ | 413 << channels_ |
| 408 << ", Sample Format: " << av_frame_->format << " vs " | 414 << ", Sample Format: " << av_frame_->format << " vs " |
| 409 << av_sample_format_; | 415 << av_sample_format_; |
| 410 | 416 |
| 411 // This is an unrecoverable error, so bail out. | 417 // This is an unrecoverable error, so bail out. |
| 412 QueuedAudioBuffer queue_entry = { kDecodeError, NULL }; | 418 QueuedAudioBuffer queue_entry = { kDecodeError, NULL }; |
| 413 queued_audio_.push_back(queue_entry); | 419 queued_audio_.push_back(queue_entry); |
| 414 break; | 420 break; |
| 415 } | 421 } |
| 416 | 422 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 // Decoding finished successfully, update statistics. | 497 // Decoding finished successfully, update statistics. |
| 492 if (result > 0) { | 498 if (result > 0) { |
| 493 PipelineStatistics statistics; | 499 PipelineStatistics statistics; |
| 494 statistics.audio_bytes_decoded = result; | 500 statistics.audio_bytes_decoded = result; |
| 495 statistics_cb_.Run(statistics); | 501 statistics_cb_.Run(statistics); |
| 496 } | 502 } |
| 497 } while (packet.size > 0); | 503 } while (packet.size > 0); |
| 498 } | 504 } |
| 499 | 505 |
| 500 } // namespace media | 506 } // namespace media |
| OLD | NEW |