| 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/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 20 matching lines...) Expand all Loading... |
| 31 // drift below that. | 31 // drift below that. |
| 32 const int64 kOutOfSyncThresholdInMilliseconds = 100; | 32 const int64 kOutOfSyncThresholdInMilliseconds = 100; |
| 33 return std::abs(timestamp_1.InMilliseconds() - timestamp_2.InMilliseconds()) > | 33 return std::abs(timestamp_1.InMilliseconds() - timestamp_2.InMilliseconds()) > |
| 34 kOutOfSyncThresholdInMilliseconds; | 34 kOutOfSyncThresholdInMilliseconds; |
| 35 } | 35 } |
| 36 | 36 |
| 37 DecryptingAudioDecoder::DecryptingAudioDecoder( | 37 DecryptingAudioDecoder::DecryptingAudioDecoder( |
| 38 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 38 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 39 const SetDecryptorReadyCB& set_decryptor_ready_cb) | 39 const SetDecryptorReadyCB& set_decryptor_ready_cb) |
| 40 : task_runner_(task_runner), | 40 : task_runner_(task_runner), |
| 41 weak_factory_(this), | |
| 42 state_(kUninitialized), | 41 state_(kUninitialized), |
| 43 demuxer_stream_(NULL), | 42 demuxer_stream_(NULL), |
| 44 set_decryptor_ready_cb_(set_decryptor_ready_cb), | 43 set_decryptor_ready_cb_(set_decryptor_ready_cb), |
| 45 decryptor_(NULL), | 44 decryptor_(NULL), |
| 46 key_added_while_decode_pending_(false), | 45 key_added_while_decode_pending_(false), |
| 47 bits_per_channel_(0), | 46 bits_per_channel_(0), |
| 48 channel_layout_(CHANNEL_LAYOUT_NONE), | 47 channel_layout_(CHANNEL_LAYOUT_NONE), |
| 49 samples_per_second_(0) { | 48 samples_per_second_(0), |
| 50 } | 49 weak_factory_(this) {} |
| 51 | 50 |
| 52 void DecryptingAudioDecoder::Initialize( | 51 void DecryptingAudioDecoder::Initialize( |
| 53 DemuxerStream* stream, | 52 DemuxerStream* stream, |
| 54 const PipelineStatusCB& status_cb, | 53 const PipelineStatusCB& status_cb, |
| 55 const StatisticsCB& statistics_cb) { | 54 const StatisticsCB& statistics_cb) { |
| 56 DVLOG(2) << "Initialize()"; | 55 DVLOG(2) << "Initialize()"; |
| 57 DCHECK(task_runner_->BelongsToCurrentThread()); | 56 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 58 DCHECK_EQ(state_, kUninitialized) << state_; | 57 DCHECK_EQ(state_, kUninitialized) << state_; |
| 59 DCHECK(stream); | 58 DCHECK(stream); |
| 60 | 59 |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 } | 494 } |
| 496 | 495 |
| 497 frame->set_timestamp(current_time); | 496 frame->set_timestamp(current_time); |
| 498 frame->set_duration( | 497 frame->set_duration( |
| 499 timestamp_helper_->GetFrameDuration(frame->frame_count())); | 498 timestamp_helper_->GetFrameDuration(frame->frame_count())); |
| 500 timestamp_helper_->AddFrames(frame->frame_count()); | 499 timestamp_helper_->AddFrames(frame->frame_count()); |
| 501 } | 500 } |
| 502 } | 501 } |
| 503 | 502 |
| 504 } // namespace media | 503 } // namespace media |
| OLD | NEW |