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/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 frames_to_interleave *= codec_context_->channels; | 463 frames_to_interleave *= codec_context_->channels; |
464 } | 464 } |
465 | 465 |
466 converter_bus_->set_frames(total_frames); | 466 converter_bus_->set_frames(total_frames); |
467 for (int i = 0; i < converter_bus_->channels(); ++i) { | 467 for (int i = 0; i < converter_bus_->channels(); ++i) { |
468 converter_bus_->SetChannelData(i, reinterpret_cast<float*>( | 468 converter_bus_->SetChannelData(i, reinterpret_cast<float*>( |
469 av_frame_->extended_data[i])); | 469 av_frame_->extended_data[i])); |
470 } | 470 } |
471 | 471 |
472 output = new DataBuffer(decoded_audio_size); | 472 output = new DataBuffer(decoded_audio_size); |
473 output->SetDataSize(decoded_audio_size); | 473 output->set_data_size(decoded_audio_size); |
474 | 474 |
475 DCHECK_EQ(frames_to_interleave, converter_bus_->frames() - skip_frames); | 475 DCHECK_EQ(frames_to_interleave, converter_bus_->frames() - skip_frames); |
476 converter_bus_->ToInterleavedPartial( | 476 converter_bus_->ToInterleavedPartial( |
477 skip_frames, frames_to_interleave, bits_per_channel_ / 8, | 477 skip_frames, frames_to_interleave, bits_per_channel_ / 8, |
478 output->GetWritableData()); | 478 output->writable_data()); |
479 } else { | 479 } else { |
480 output = DataBuffer::CopyFrom( | 480 output = DataBuffer::CopyFrom( |
481 av_frame_->extended_data[0] + start_sample * bytes_per_frame_, | 481 av_frame_->extended_data[0] + start_sample * bytes_per_frame_, |
482 decoded_audio_size); | 482 decoded_audio_size); |
483 } | 483 } |
484 output->SetTimestamp(output_timestamp_helper_->GetTimestamp()); | 484 output->set_timestamp(output_timestamp_helper_->GetTimestamp()); |
485 output->SetDuration( | 485 output->set_duration( |
486 output_timestamp_helper_->GetDuration(decoded_audio_size)); | 486 output_timestamp_helper_->GetDuration(decoded_audio_size)); |
487 output_timestamp_helper_->AddBytes(decoded_audio_size); | 487 output_timestamp_helper_->AddBytes(decoded_audio_size); |
488 } else if (IsEndOfStream(result, decoded_audio_size, input) && | 488 } else if (IsEndOfStream(result, decoded_audio_size, input) && |
489 !skip_eos_append) { | 489 !skip_eos_append) { |
490 DCHECK_EQ(packet.size, 0); | 490 DCHECK_EQ(packet.size, 0); |
491 output = DataBuffer::CreateEOSBuffer(); | 491 output = DataBuffer::CreateEOSBuffer(); |
492 } | 492 } |
493 | 493 |
494 if (output.get()) { | 494 if (output.get()) { |
495 QueuedAudioBuffer queue_entry = { kOk, output }; | 495 QueuedAudioBuffer queue_entry = { kOk, output }; |
496 queued_audio_.push_back(queue_entry); | 496 queued_audio_.push_back(queue_entry); |
497 } | 497 } |
498 | 498 |
499 // Decoding finished successfully, update statistics. | 499 // Decoding finished successfully, update statistics. |
500 if (result > 0) { | 500 if (result > 0) { |
501 PipelineStatistics statistics; | 501 PipelineStatistics statistics; |
502 statistics.audio_bytes_decoded = result; | 502 statistics.audio_bytes_decoded = result; |
503 statistics_cb_.Run(statistics); | 503 statistics_cb_.Run(statistics); |
504 } | 504 } |
505 } while (packet.size > 0); | 505 } while (packet.size > 0); |
506 } | 506 } |
507 | 507 |
508 } // namespace media | 508 } // namespace media |
OLD | NEW |