| 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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 const scoped_refptr<DecoderBuffer>& input, | 298 const scoped_refptr<DecoderBuffer>& input, |
| 299 const DecodeCB& decode_cb) { | 299 const DecodeCB& decode_cb) { |
| 300 DCHECK(task_runner_->BelongsToCurrentThread()); | 300 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 301 DCHECK(!decode_cb.is_null()); | 301 DCHECK(!decode_cb.is_null()); |
| 302 | 302 |
| 303 DCHECK(input.get()); | 303 DCHECK(input.get()); |
| 304 | 304 |
| 305 // Libopus does not buffer output. Decoding is complete when an end of stream | 305 // Libopus does not buffer output. Decoding is complete when an end of stream |
| 306 // input buffer is received. | 306 // input buffer is received. |
| 307 if (input->end_of_stream()) { | 307 if (input->end_of_stream()) { |
| 308 output_cb_.Run(AudioBuffer::CreateEOSBuffer()); | |
| 309 decode_cb.Run(kOk); | 308 decode_cb.Run(kOk); |
| 310 return; | 309 return; |
| 311 } | 310 } |
| 312 | 311 |
| 313 // Make sure we are notified if http://crbug.com/49709 returns. Issue also | 312 // Make sure we are notified if http://crbug.com/49709 returns. Issue also |
| 314 // occurs with some damaged files. | 313 // occurs with some damaged files. |
| 315 if (input->timestamp() == kNoTimestamp()) { | 314 if (input->timestamp() == kNoTimestamp()) { |
| 316 DLOG(ERROR) << "Received a buffer without timestamps!"; | 315 DLOG(ERROR) << "Received a buffer without timestamps!"; |
| 317 decode_cb.Run(kDecodeError); | 316 decode_cb.Run(kDecodeError); |
| 318 return; | 317 return; |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 output_buffer->get()->TrimEnd(trim_frames); | 476 output_buffer->get()->TrimEnd(trim_frames); |
| 478 | 477 |
| 479 // Handles discards and timestamping. Discard the buffer if more data needed. | 478 // Handles discards and timestamping. Discard the buffer if more data needed. |
| 480 if (!discard_helper_->ProcessBuffers(input, *output_buffer)) | 479 if (!discard_helper_->ProcessBuffers(input, *output_buffer)) |
| 481 *output_buffer = NULL; | 480 *output_buffer = NULL; |
| 482 | 481 |
| 483 return true; | 482 return true; |
| 484 } | 483 } |
| 485 | 484 |
| 486 } // namespace media | 485 } // namespace media |
| OLD | NEW |