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

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

Issue 193303002: WeakPtr destruction order cleanup: media edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 DVLOG(1) << "Inconsistent channel mapping."; 248 DVLOG(1) << "Inconsistent channel mapping.";
249 249
250 for (int i = 0; i < extra_data->channels; ++i) 250 for (int i = 0; i < extra_data->channels; ++i)
251 extra_data->stream_map[i] = *(data + kOpusExtraDataStreamMapOffset + i); 251 extra_data->stream_map[i] = *(data + kOpusExtraDataStreamMapOffset + i);
252 return true; 252 return true;
253 } 253 }
254 254
255 OpusAudioDecoder::OpusAudioDecoder( 255 OpusAudioDecoder::OpusAudioDecoder(
256 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) 256 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner)
257 : task_runner_(task_runner), 257 : task_runner_(task_runner),
258 weak_factory_(this),
259 demuxer_stream_(NULL), 258 demuxer_stream_(NULL),
260 opus_decoder_(NULL), 259 opus_decoder_(NULL),
261 channel_layout_(CHANNEL_LAYOUT_NONE), 260 channel_layout_(CHANNEL_LAYOUT_NONE),
262 samples_per_second_(0), 261 samples_per_second_(0),
263 sample_format_(kSampleFormatF32), 262 sample_format_(kSampleFormatF32),
264 bits_per_channel_(SampleFormatToBytesPerChannel(sample_format_) * 8), 263 bits_per_channel_(SampleFormatToBytesPerChannel(sample_format_) * 8),
265 last_input_timestamp_(kNoTimestamp()), 264 last_input_timestamp_(kNoTimestamp()),
266 frames_to_discard_(0), 265 frames_to_discard_(0),
267 frame_delay_at_start_(0), 266 frame_delay_at_start_(0),
268 start_input_timestamp_(kNoTimestamp()) { 267 start_input_timestamp_(kNoTimestamp()),
269 } 268 weak_factory_(this) {}
270 269
271 void OpusAudioDecoder::Initialize( 270 void OpusAudioDecoder::Initialize(
272 DemuxerStream* stream, 271 DemuxerStream* stream,
273 const PipelineStatusCB& status_cb, 272 const PipelineStatusCB& status_cb,
274 const StatisticsCB& statistics_cb) { 273 const StatisticsCB& statistics_cb) {
275 DCHECK(task_runner_->BelongsToCurrentThread()); 274 DCHECK(task_runner_->BelongsToCurrentThread());
276 PipelineStatusCB initialize_cb = BindToCurrentLoop(status_cb); 275 PipelineStatusCB initialize_cb = BindToCurrentLoop(status_cb);
277 276
278 if (demuxer_stream_) { 277 if (demuxer_stream_) {
279 // TODO(scherkus): initialization currently happens more than once in 278 // TODO(scherkus): initialization currently happens more than once in
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 output_timestamp_helper_->AddFrames(frames_decoded); 669 output_timestamp_helper_->AddFrames(frames_decoded);
671 670
672 // Discard the buffer to indicate we need more data. 671 // Discard the buffer to indicate we need more data.
673 if (!frames_to_output) 672 if (!frames_to_output)
674 *output_buffer = NULL; 673 *output_buffer = NULL;
675 674
676 return true; 675 return true;
677 } 676 }
678 677
679 } // namespace media 678 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698