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/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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 extra_data->stream_map[i] = *(data + kOpusExtraDataStreamMapOffset + i); | 242 extra_data->stream_map[i] = *(data + kOpusExtraDataStreamMapOffset + i); |
243 return true; | 243 return true; |
244 } | 244 } |
245 | 245 |
246 OpusAudioDecoder::OpusAudioDecoder( | 246 OpusAudioDecoder::OpusAudioDecoder( |
247 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) | 247 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) |
248 : task_runner_(task_runner), | 248 : task_runner_(task_runner), |
249 opus_decoder_(NULL), | 249 opus_decoder_(NULL), |
250 start_input_timestamp_(kNoTimestamp()) {} | 250 start_input_timestamp_(kNoTimestamp()) {} |
251 | 251 |
| 252 std::string OpusAudioDecoder::GetDisplayName() const { |
| 253 return "OpusAudioDecoder"; |
| 254 } |
| 255 |
252 void OpusAudioDecoder::Initialize(const AudioDecoderConfig& config, | 256 void OpusAudioDecoder::Initialize(const AudioDecoderConfig& config, |
253 const PipelineStatusCB& status_cb, | 257 const PipelineStatusCB& status_cb, |
254 const OutputCB& output_cb) { | 258 const OutputCB& output_cb) { |
255 DCHECK(task_runner_->BelongsToCurrentThread()); | 259 DCHECK(task_runner_->BelongsToCurrentThread()); |
256 PipelineStatusCB initialize_cb = BindToCurrentLoop(status_cb); | 260 PipelineStatusCB initialize_cb = BindToCurrentLoop(status_cb); |
257 | 261 |
258 config_ = config; | 262 config_ = config; |
259 output_cb_ = BindToCurrentLoop(output_cb); | 263 output_cb_ = BindToCurrentLoop(output_cb); |
260 | 264 |
261 if (!ConfigureDecoder()) { | 265 if (!ConfigureDecoder()) { |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 output_buffer->get()->TrimEnd(trim_frames); | 478 output_buffer->get()->TrimEnd(trim_frames); |
475 | 479 |
476 // Handles discards and timestamping. Discard the buffer if more data needed. | 480 // Handles discards and timestamping. Discard the buffer if more data needed. |
477 if (!discard_helper_->ProcessBuffers(input, *output_buffer)) | 481 if (!discard_helper_->ProcessBuffers(input, *output_buffer)) |
478 *output_buffer = NULL; | 482 *output_buffer = NULL; |
479 | 483 |
480 return true; | 484 return true; |
481 } | 485 } |
482 | 486 |
483 } // namespace media | 487 } // namespace media |
OLD | NEW |