| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/opus_audio_decoder.h" | 5 #include "media/filters/opus_audio_decoder.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/sys_byteorder.h" | 10 #include "base/sys_byteorder.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 125 |
| 126 OpusAudioDecoder::OpusAudioDecoder( | 126 OpusAudioDecoder::OpusAudioDecoder( |
| 127 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) | 127 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) |
| 128 : task_runner_(task_runner), opus_decoder_(nullptr) {} | 128 : task_runner_(task_runner), opus_decoder_(nullptr) {} |
| 129 | 129 |
| 130 std::string OpusAudioDecoder::GetDisplayName() const { | 130 std::string OpusAudioDecoder::GetDisplayName() const { |
| 131 return "OpusAudioDecoder"; | 131 return "OpusAudioDecoder"; |
| 132 } | 132 } |
| 133 | 133 |
| 134 void OpusAudioDecoder::Initialize(const AudioDecoderConfig& config, | 134 void OpusAudioDecoder::Initialize(const AudioDecoderConfig& config, |
| 135 const SetCdmReadyCB& /* set_cdm_ready_cb */, |
| 135 const InitCB& init_cb, | 136 const InitCB& init_cb, |
| 136 const OutputCB& output_cb) { | 137 const OutputCB& output_cb) { |
| 137 DCHECK(task_runner_->BelongsToCurrentThread()); | 138 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 138 InitCB bound_init_cb = BindToCurrentLoop(init_cb); | 139 InitCB bound_init_cb = BindToCurrentLoop(init_cb); |
| 139 | 140 |
| 140 if (config.is_encrypted()) { | 141 if (config.is_encrypted()) { |
| 141 bound_init_cb.Run(false); | 142 bound_init_cb.Run(false); |
| 142 return; | 143 return; |
| 143 } | 144 } |
| 144 | 145 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 output_buffer->get()->TrimEnd(trim_frames); | 353 output_buffer->get()->TrimEnd(trim_frames); |
| 353 | 354 |
| 354 // Handles discards and timestamping. Discard the buffer if more data needed. | 355 // Handles discards and timestamping. Discard the buffer if more data needed. |
| 355 if (!discard_helper_->ProcessBuffers(input, *output_buffer)) | 356 if (!discard_helper_->ProcessBuffers(input, *output_buffer)) |
| 356 *output_buffer = nullptr; | 357 *output_buffer = nullptr; |
| 357 | 358 |
| 358 return true; | 359 return true; |
| 359 } | 360 } |
| 360 | 361 |
| 361 } // namespace media | 362 } // namespace media |
| OLD | NEW |