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

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

Issue 17408005: Refactored DecoderBuffer to use unix_hacker_style naming. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@localrefactor
Patch Set: Fixed naming error that somehow got reverted" Created 7 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
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 <cstdlib> 7 #include <cstdlib>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 DVLOG(2) << "DecryptAndDecodeBuffer() - kAborted"; 304 DVLOG(2) << "DecryptAndDecodeBuffer() - kAborted";
305 state_ = kIdle; 305 state_ = kIdle;
306 base::ResetAndReturn(&read_cb_).Run(kAborted, NULL); 306 base::ResetAndReturn(&read_cb_).Run(kAborted, NULL);
307 return; 307 return;
308 } 308 }
309 309
310 DCHECK_EQ(status, DemuxerStream::kOk); 310 DCHECK_EQ(status, DemuxerStream::kOk);
311 311
312 // Initialize the |next_output_timestamp_| to be the timestamp of the first 312 // Initialize the |next_output_timestamp_| to be the timestamp of the first
313 // non-EOS buffer. 313 // non-EOS buffer.
314 if (output_timestamp_base_ == kNoTimestamp() && !buffer->IsEndOfStream()) { 314 if (output_timestamp_base_ == kNoTimestamp() && !buffer->end_of_stream()) {
315 DCHECK_EQ(total_samples_decoded_, 0); 315 DCHECK_EQ(total_samples_decoded_, 0);
316 output_timestamp_base_ = buffer->GetTimestamp(); 316 output_timestamp_base_ = buffer->timestamp();
317 } 317 }
318 318
319 pending_buffer_to_decode_ = buffer; 319 pending_buffer_to_decode_ = buffer;
320 state_ = kPendingDecode; 320 state_ = kPendingDecode;
321 DecodePendingBuffer(); 321 DecodePendingBuffer();
322 } 322 }
323 323
324 void DecryptingAudioDecoder::DecodePendingBuffer() { 324 void DecryptingAudioDecoder::DecodePendingBuffer() {
325 DCHECK(message_loop_->BelongsToCurrentThread()); 325 DCHECK(message_loop_->BelongsToCurrentThread());
326 DCHECK_EQ(state_, kPendingDecode) << state_; 326 DCHECK_EQ(state_, kPendingDecode) << state_;
327 327
328 int buffer_size = 0; 328 int buffer_size = 0;
329 if (!pending_buffer_to_decode_->IsEndOfStream()) { 329 if (!pending_buffer_to_decode_->end_of_stream()) {
330 buffer_size = pending_buffer_to_decode_->GetDataSize(); 330 buffer_size = pending_buffer_to_decode_->data_size();
331 } 331 }
332 332
333 decryptor_->DecryptAndDecodeAudio( 333 decryptor_->DecryptAndDecodeAudio(
334 pending_buffer_to_decode_, 334 pending_buffer_to_decode_,
335 BindToCurrentLoop(base::Bind( 335 BindToCurrentLoop(base::Bind(
336 &DecryptingAudioDecoder::DeliverFrame, weak_this_, buffer_size))); 336 &DecryptingAudioDecoder::DeliverFrame, weak_this_, buffer_size)));
337 } 337 }
338 338
339 void DecryptingAudioDecoder::DeliverFrame( 339 void DecryptingAudioDecoder::DeliverFrame(
340 int buffer_size, 340 int buffer_size,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 387
388 // The buffer has been accepted by the decoder, let's report statistics. 388 // The buffer has been accepted by the decoder, let's report statistics.
389 if (buffer_size) { 389 if (buffer_size) {
390 PipelineStatistics statistics; 390 PipelineStatistics statistics;
391 statistics.audio_bytes_decoded = buffer_size; 391 statistics.audio_bytes_decoded = buffer_size;
392 statistics_cb_.Run(statistics); 392 statistics_cb_.Run(statistics);
393 } 393 }
394 394
395 if (status == Decryptor::kNeedMoreData) { 395 if (status == Decryptor::kNeedMoreData) {
396 DVLOG(2) << "DeliverFrame() - kNeedMoreData"; 396 DVLOG(2) << "DeliverFrame() - kNeedMoreData";
397 if (scoped_pending_buffer_to_decode->IsEndOfStream()) { 397 if (scoped_pending_buffer_to_decode->end_of_stream()) {
398 state_ = kDecodeFinished; 398 state_ = kDecodeFinished;
399 base::ResetAndReturn(&read_cb_).Run(kOk, DataBuffer::CreateEOSBuffer()); 399 base::ResetAndReturn(&read_cb_).Run(kOk, DataBuffer::CreateEOSBuffer());
400 return; 400 return;
401 } 401 }
402 402
403 state_ = kPendingDemuxerRead; 403 state_ = kPendingDemuxerRead;
404 ReadFromDemuxerStream(); 404 ReadFromDemuxerStream();
405 return; 405 return;
406 } 406 }
407 407
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 486
487 base::TimeDelta DecryptingAudioDecoder::NumberOfSamplesToDuration( 487 base::TimeDelta DecryptingAudioDecoder::NumberOfSamplesToDuration(
488 int number_of_samples) const { 488 int number_of_samples) const {
489 DCHECK(samples_per_second_); 489 DCHECK(samples_per_second_);
490 return base::TimeDelta::FromMicroseconds(base::Time::kMicrosecondsPerSecond * 490 return base::TimeDelta::FromMicroseconds(base::Time::kMicrosecondsPerSecond *
491 number_of_samples / 491 number_of_samples /
492 samples_per_second_); 492 samples_per_second_);
493 } 493 }
494 494
495 } // namespace media 495 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698