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

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

Issue 506683002: Remove implicit conversions from scoped_refptr to T* in media/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/decoder_stream.h" 5 #include "media/filters/decoder_stream.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 base::ResetAndReturn(&read_cb_).Run(status, output); 248 base::ResetAndReturn(&read_cb_).Run(status, output);
249 } 249 }
250 250
251 template <DemuxerStream::Type StreamType> 251 template <DemuxerStream::Type StreamType>
252 void DecoderStream<StreamType>::Decode( 252 void DecoderStream<StreamType>::Decode(
253 const scoped_refptr<DecoderBuffer>& buffer) { 253 const scoped_refptr<DecoderBuffer>& buffer) {
254 FUNCTION_DVLOG(2); 254 FUNCTION_DVLOG(2);
255 DCHECK(state_ == STATE_NORMAL || state_ == STATE_FLUSHING_DECODER) << state_; 255 DCHECK(state_ == STATE_NORMAL || state_ == STATE_FLUSHING_DECODER) << state_;
256 DCHECK_LT(pending_decode_requests_, GetMaxDecodeRequests()); 256 DCHECK_LT(pending_decode_requests_, GetMaxDecodeRequests());
257 DCHECK(reset_cb_.is_null()); 257 DCHECK(reset_cb_.is_null());
258 DCHECK(buffer); 258 DCHECK(buffer.get());
259 259
260 int buffer_size = buffer->end_of_stream() ? 0 : buffer->data_size(); 260 int buffer_size = buffer->end_of_stream() ? 0 : buffer->data_size();
261 261
262 TRACE_EVENT_ASYNC_BEGIN0("media", GetTraceString<StreamType>(), this); 262 TRACE_EVENT_ASYNC_BEGIN0("media", GetTraceString<StreamType>(), this);
263 ++pending_decode_requests_; 263 ++pending_decode_requests_;
264 decoder_->Decode(buffer, 264 decoder_->Decode(buffer,
265 base::Bind(&DecoderStream<StreamType>::OnDecodeDone, 265 base::Bind(&DecoderStream<StreamType>::OnDecodeDone,
266 weak_factory_.GetWeakPtr(), 266 weak_factory_.GetWeakPtr(),
267 buffer_size, 267 buffer_size,
268 buffer->end_of_stream())); 268 buffer->end_of_stream()));
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 if (state_ == STATE_FLUSHING_DECODER && !pending_decode_requests_) 332 if (state_ == STATE_FLUSHING_DECODER && !pending_decode_requests_)
333 ReinitializeDecoder(); 333 ReinitializeDecoder();
334 return; 334 return;
335 } 335 }
336 } 336 }
337 337
338 template <DemuxerStream::Type StreamType> 338 template <DemuxerStream::Type StreamType>
339 void DecoderStream<StreamType>::OnDecodeOutputReady( 339 void DecoderStream<StreamType>::OnDecodeOutputReady(
340 const scoped_refptr<Output>& output) { 340 const scoped_refptr<Output>& output) {
341 FUNCTION_DVLOG(2) << ": " << output->timestamp().InMilliseconds() << " ms"; 341 FUNCTION_DVLOG(2) << ": " << output->timestamp().InMilliseconds() << " ms";
342 DCHECK(output); 342 DCHECK(output.get());
343 DCHECK(!output->end_of_stream()); 343 DCHECK(!output->end_of_stream());
344 DCHECK(state_ == STATE_NORMAL || state_ == STATE_FLUSHING_DECODER || 344 DCHECK(state_ == STATE_NORMAL || state_ == STATE_FLUSHING_DECODER ||
345 state_ == STATE_PENDING_DEMUXER_READ || state_ == STATE_ERROR) 345 state_ == STATE_PENDING_DEMUXER_READ || state_ == STATE_ERROR)
346 << state_; 346 << state_;
347 347
348 if (state_ == STATE_ERROR) { 348 if (state_ == STATE_ERROR) {
349 DCHECK(read_cb_.is_null()); 349 DCHECK(read_cb_.is_null());
350 return; 350 return;
351 } 351 }
352 352
(...skipping 26 matching lines...) Expand all
379 state_ = STATE_PENDING_DEMUXER_READ; 379 state_ = STATE_PENDING_DEMUXER_READ;
380 stream_->Read(base::Bind(&DecoderStream<StreamType>::OnBufferReady, 380 stream_->Read(base::Bind(&DecoderStream<StreamType>::OnBufferReady,
381 weak_factory_.GetWeakPtr())); 381 weak_factory_.GetWeakPtr()));
382 } 382 }
383 383
384 template <DemuxerStream::Type StreamType> 384 template <DemuxerStream::Type StreamType>
385 void DecoderStream<StreamType>::OnBufferReady( 385 void DecoderStream<StreamType>::OnBufferReady(
386 DemuxerStream::Status status, 386 DemuxerStream::Status status,
387 const scoped_refptr<DecoderBuffer>& buffer) { 387 const scoped_refptr<DecoderBuffer>& buffer) {
388 FUNCTION_DVLOG(2) << ": " << status << ", " 388 FUNCTION_DVLOG(2) << ": " << status << ", "
389 << (buffer ? buffer->AsHumanReadableString() : "NULL"); 389 << (buffer.get() ? buffer->AsHumanReadableString()
390 : "NULL");
390 391
391 DCHECK(task_runner_->BelongsToCurrentThread()); 392 DCHECK(task_runner_->BelongsToCurrentThread());
392 DCHECK(state_ == STATE_PENDING_DEMUXER_READ || state_ == STATE_ERROR) 393 DCHECK(state_ == STATE_PENDING_DEMUXER_READ || state_ == STATE_ERROR)
393 << state_; 394 << state_;
394 DCHECK_EQ(buffer.get() != NULL, status == DemuxerStream::kOk) << status; 395 DCHECK_EQ(buffer.get() != NULL, status == DemuxerStream::kOk) << status;
395 396
396 // Decoding has been stopped (e.g due to an error). 397 // Decoding has been stopped (e.g due to an error).
397 if (state_ != STATE_PENDING_DEMUXER_READ) { 398 if (state_ != STATE_PENDING_DEMUXER_READ) {
398 DCHECK(state_ == STATE_ERROR); 399 DCHECK(state_ == STATE_ERROR);
399 DCHECK(read_cb_.is_null()); 400 DCHECK(read_cb_.is_null());
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 } 533 }
533 534
534 // The resetting process will be continued in OnDecoderReinitialized(). 535 // The resetting process will be continued in OnDecoderReinitialized().
535 ReinitializeDecoder(); 536 ReinitializeDecoder();
536 } 537 }
537 538
538 template class DecoderStream<DemuxerStream::VIDEO>; 539 template class DecoderStream<DemuxerStream::VIDEO>;
539 template class DecoderStream<DemuxerStream::AUDIO>; 540 template class DecoderStream<DemuxerStream::AUDIO>;
540 541
541 } // namespace media 542 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698