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

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

Issue 193303002: WeakPtr destruction order cleanup: media edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 6 years, 9 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
« no previous file with comments | « media/filters/decrypting_audio_decoder.h ('k') | media/filters/decrypting_demuxer_stream.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 20 matching lines...) Expand all
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 set_decryptor_ready_cb_(set_decryptor_ready_cb), 42 set_decryptor_ready_cb_(set_decryptor_ready_cb),
44 decryptor_(NULL), 43 decryptor_(NULL),
45 key_added_while_decode_pending_(false), 44 key_added_while_decode_pending_(false),
46 bits_per_channel_(0), 45 bits_per_channel_(0),
47 channel_layout_(CHANNEL_LAYOUT_NONE), 46 channel_layout_(CHANNEL_LAYOUT_NONE),
48 samples_per_second_(0) { 47 samples_per_second_(0),
49 } 48 weak_factory_(this) {}
50 49
51 void DecryptingAudioDecoder::Initialize(const AudioDecoderConfig& config, 50 void DecryptingAudioDecoder::Initialize(const AudioDecoderConfig& config,
52 const PipelineStatusCB& status_cb) { 51 const PipelineStatusCB& status_cb) {
53 DVLOG(2) << "Initialize()"; 52 DVLOG(2) << "Initialize()";
54 DCHECK(task_runner_->BelongsToCurrentThread()); 53 DCHECK(task_runner_->BelongsToCurrentThread());
55 DCHECK(decode_cb_.is_null()); 54 DCHECK(decode_cb_.is_null());
56 DCHECK(reset_cb_.is_null()); 55 DCHECK(reset_cb_.is_null());
57 56
58 weak_this_ = weak_factory_.GetWeakPtr(); 57 weak_this_ = weak_factory_.GetWeakPtr();
59 init_cb_ = BindToCurrentLoop(status_cb); 58 init_cb_ = BindToCurrentLoop(status_cb);
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 } 408 }
410 409
411 frame->set_timestamp(current_time); 410 frame->set_timestamp(current_time);
412 frame->set_duration( 411 frame->set_duration(
413 timestamp_helper_->GetFrameDuration(frame->frame_count())); 412 timestamp_helper_->GetFrameDuration(frame->frame_count()));
414 timestamp_helper_->AddFrames(frame->frame_count()); 413 timestamp_helper_->AddFrames(frame->frame_count());
415 } 414 }
416 } 415 }
417 416
418 } // namespace media 417 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/decrypting_audio_decoder.h ('k') | media/filters/decrypting_demuxer_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698