Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2007)

Side by Side Diff: media/filters/opus_audio_decoder.cc

Issue 311373004: Consolidate and improve audio decoding test for all decoders. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 DCHECK(task_runner_->BelongsToCurrentThread()); 285 DCHECK(task_runner_->BelongsToCurrentThread());
286 286
287 if (!opus_decoder_) 287 if (!opus_decoder_)
288 return; 288 return;
289 289
290 opus_multistream_decoder_ctl(opus_decoder_, OPUS_RESET_STATE); 290 opus_multistream_decoder_ctl(opus_decoder_, OPUS_RESET_STATE);
291 ResetTimestampState(); 291 ResetTimestampState();
292 CloseDecoder(); 292 CloseDecoder();
293 } 293 }
294 294
295 OpusAudioDecoder::~OpusAudioDecoder() {} 295 OpusAudioDecoder::~OpusAudioDecoder() {
296 DCHECK(!opus_decoder_);
297 }
296 298
297 void OpusAudioDecoder::DecodeBuffer( 299 void OpusAudioDecoder::DecodeBuffer(
298 const scoped_refptr<DecoderBuffer>& input, 300 const scoped_refptr<DecoderBuffer>& input,
299 const DecodeCB& decode_cb) { 301 const DecodeCB& decode_cb) {
300 DCHECK(task_runner_->BelongsToCurrentThread()); 302 DCHECK(task_runner_->BelongsToCurrentThread());
301 DCHECK(!decode_cb.is_null()); 303 DCHECK(!decode_cb.is_null());
302 304 DCHECK(input);
303 DCHECK(input.get());
304 305
305 // Libopus does not buffer output. Decoding is complete when an end of stream 306 // Libopus does not buffer output. Decoding is complete when an end of stream
306 // input buffer is received. 307 // input buffer is received.
307 if (input->end_of_stream()) { 308 if (input->end_of_stream()) {
308 decode_cb.Run(kOk); 309 decode_cb.Run(kOk);
309 return; 310 return;
310 } 311 }
311 312
312 // Make sure we are notified if http://crbug.com/49709 returns. Issue also 313 // Make sure we are notified if http://crbug.com/49709 returns. Issue also
313 // occurs with some damaged files. 314 // occurs with some damaged files.
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 output_buffer->get()->TrimEnd(trim_frames); 477 output_buffer->get()->TrimEnd(trim_frames);
477 478
478 // Handles discards and timestamping. Discard the buffer if more data needed. 479 // Handles discards and timestamping. Discard the buffer if more data needed.
479 if (!discard_helper_->ProcessBuffers(input, *output_buffer)) 480 if (!discard_helper_->ProcessBuffers(input, *output_buffer))
480 *output_buffer = NULL; 481 *output_buffer = NULL;
481 482
482 return true; 483 return true;
483 } 484 }
484 485
485 } // namespace media 486 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_audio_decoder_unittest.cc ('k') | media/filters/opus_audio_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698