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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 195 |
196 // Libopus does not buffer output. Decoding is complete when an end of stream | 196 // Libopus does not buffer output. Decoding is complete when an end of stream |
197 // input buffer is received. | 197 // input buffer is received. |
198 if (input->end_of_stream()) { | 198 if (input->end_of_stream()) { |
199 decode_cb.Run(DecodeStatus::OK); | 199 decode_cb.Run(DecodeStatus::OK); |
200 return; | 200 return; |
201 } | 201 } |
202 | 202 |
203 // Make sure we are notified if http://crbug.com/49709 returns. Issue also | 203 // Make sure we are notified if http://crbug.com/49709 returns. Issue also |
204 // occurs with some damaged files. | 204 // occurs with some damaged files. |
205 if (input->timestamp() == kNoTimestamp()) { | 205 if (input->timestamp() == kNoTimestamp) { |
206 DLOG(ERROR) << "Received a buffer without timestamps!"; | 206 DLOG(ERROR) << "Received a buffer without timestamps!"; |
207 decode_cb.Run(DecodeStatus::DECODE_ERROR); | 207 decode_cb.Run(DecodeStatus::DECODE_ERROR); |
208 return; | 208 return; |
209 } | 209 } |
210 | 210 |
211 scoped_refptr<AudioBuffer> output_buffer; | 211 scoped_refptr<AudioBuffer> output_buffer; |
212 | 212 |
213 if (!Decode(input, &output_buffer)) { | 213 if (!Decode(input, &output_buffer)) { |
214 decode_cb.Run(DecodeStatus::DECODE_ERROR); | 214 decode_cb.Run(DecodeStatus::DECODE_ERROR); |
215 return; | 215 return; |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 output_buffer->get()->TrimEnd(trim_frames); | 359 output_buffer->get()->TrimEnd(trim_frames); |
360 | 360 |
361 // Handles discards and timestamping. Discard the buffer if more data needed. | 361 // Handles discards and timestamping. Discard the buffer if more data needed. |
362 if (!discard_helper_->ProcessBuffers(input, *output_buffer)) | 362 if (!discard_helper_->ProcessBuffers(input, *output_buffer)) |
363 *output_buffer = nullptr; | 363 *output_buffer = nullptr; |
364 | 364 |
365 return true; | 365 return true; |
366 } | 366 } |
367 | 367 |
368 } // namespace media | 368 } // namespace media |
OLD | NEW |