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

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

Issue 2158923004: Convert media constants to constexpr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
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/decrypting_audio_decoder.h" 5 #include "media/filters/decrypting_audio_decoder.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <cstdlib> 9 #include <cstdlib>
10 10
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 // Return empty (end-of-stream) frames if decoding has finished. 108 // Return empty (end-of-stream) frames if decoding has finished.
109 if (state_ == kDecodeFinished) { 109 if (state_ == kDecodeFinished) {
110 output_cb_.Run(AudioBuffer::CreateEOSBuffer()); 110 output_cb_.Run(AudioBuffer::CreateEOSBuffer());
111 base::ResetAndReturn(&decode_cb_).Run(DecodeStatus::OK); 111 base::ResetAndReturn(&decode_cb_).Run(DecodeStatus::OK);
112 return; 112 return;
113 } 113 }
114 114
115 // Initialize the |next_output_timestamp_| to be the timestamp of the first 115 // Initialize the |next_output_timestamp_| to be the timestamp of the first
116 // non-EOS buffer. 116 // non-EOS buffer.
117 if (timestamp_helper_->base_timestamp() == kNoTimestamp() && 117 if (timestamp_helper_->base_timestamp() == kNoTimestamp &&
118 !buffer->end_of_stream()) { 118 !buffer->end_of_stream()) {
119 timestamp_helper_->SetBaseTimestamp(buffer->timestamp()); 119 timestamp_helper_->SetBaseTimestamp(buffer->timestamp());
120 } 120 }
121 121
122 pending_buffer_to_decode_ = buffer; 122 pending_buffer_to_decode_ = buffer;
123 state_ = kPendingDecode; 123 state_ = kPendingDecode;
124 DecodePendingBuffer(); 124 DecodePendingBuffer();
125 } 125 }
126 126
127 void DecryptingAudioDecoder::Reset(const base::Closure& closure) { 127 void DecryptingAudioDecoder::Reset(const base::Closure& closure) {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 316
317 if (state_ == kWaitingForKey) { 317 if (state_ == kWaitingForKey) {
318 state_ = kPendingDecode; 318 state_ = kPendingDecode;
319 DecodePendingBuffer(); 319 DecodePendingBuffer();
320 } 320 }
321 } 321 }
322 322
323 void DecryptingAudioDecoder::DoReset() { 323 void DecryptingAudioDecoder::DoReset() {
324 DCHECK(init_cb_.is_null()); 324 DCHECK(init_cb_.is_null());
325 DCHECK(decode_cb_.is_null()); 325 DCHECK(decode_cb_.is_null());
326 timestamp_helper_->SetBaseTimestamp(kNoTimestamp()); 326 timestamp_helper_->SetBaseTimestamp(kNoTimestamp);
327 state_ = kIdle; 327 state_ = kIdle;
328 base::ResetAndReturn(&reset_cb_).Run(); 328 base::ResetAndReturn(&reset_cb_).Run();
329 } 329 }
330 330
331 void DecryptingAudioDecoder::ProcessDecodedFrames( 331 void DecryptingAudioDecoder::ProcessDecodedFrames(
332 const Decryptor::AudioFrames& frames) { 332 const Decryptor::AudioFrames& frames) {
333 for (Decryptor::AudioFrames::const_iterator iter = frames.begin(); 333 for (Decryptor::AudioFrames::const_iterator iter = frames.begin();
334 iter != frames.end(); 334 iter != frames.end();
335 ++iter) { 335 ++iter) {
336 scoped_refptr<AudioBuffer> frame = *iter; 336 scoped_refptr<AudioBuffer> frame = *iter;
(...skipping 10 matching lines...) Expand all
347 } 347 }
348 348
349 frame->set_timestamp(current_time); 349 frame->set_timestamp(current_time);
350 timestamp_helper_->AddFrames(frame->frame_count()); 350 timestamp_helper_->AddFrames(frame->frame_count());
351 351
352 output_cb_.Run(frame); 352 output_cb_.Run(frame);
353 } 353 }
354 } 354 }
355 355
356 } // namespace media 356 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698