OLD | NEW |
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 <utility> | 7 #include <utility> |
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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 | 368 |
369 int buffer_size = buffer->end_of_stream() ? 0 : buffer->data_size(); | 369 int buffer_size = buffer->end_of_stream() ? 0 : buffer->data_size(); |
370 | 370 |
371 TRACE_EVENT_ASYNC_BEGIN2( | 371 TRACE_EVENT_ASYNC_BEGIN2( |
372 "media", GetTraceString<StreamType>(), this, "key frame", | 372 "media", GetTraceString<StreamType>(), this, "key frame", |
373 !buffer->end_of_stream() && buffer->is_key_frame(), "timestamp (ms)", | 373 !buffer->end_of_stream() && buffer->is_key_frame(), "timestamp (ms)", |
374 !buffer->end_of_stream() ? buffer->timestamp().InMilliseconds() : 0); | 374 !buffer->end_of_stream() ? buffer->timestamp().InMilliseconds() : 0); |
375 | 375 |
376 if (buffer->end_of_stream()) | 376 if (buffer->end_of_stream()) |
377 decoding_eos_ = true; | 377 decoding_eos_ = true; |
378 else if (buffer->duration() != kNoTimestamp()) | 378 else if (buffer->duration() != kNoTimestamp) |
379 duration_tracker_.AddSample(buffer->duration()); | 379 duration_tracker_.AddSample(buffer->duration()); |
380 | 380 |
381 ++pending_decode_requests_; | 381 ++pending_decode_requests_; |
382 decoder_->Decode(buffer, base::Bind(&DecoderStream<StreamType>::OnDecodeDone, | 382 decoder_->Decode(buffer, base::Bind(&DecoderStream<StreamType>::OnDecodeDone, |
383 fallback_weak_factory_.GetWeakPtr(), | 383 fallback_weak_factory_.GetWeakPtr(), |
384 buffer_size, buffer->end_of_stream())); | 384 buffer_size, buffer->end_of_stream())); |
385 } | 385 } |
386 | 386 |
387 template <DemuxerStream::Type StreamType> | 387 template <DemuxerStream::Type StreamType> |
388 void DecoderStream<StreamType>::FlushDecoder() { | 388 void DecoderStream<StreamType>::FlushDecoder() { |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 return; | 660 return; |
661 } | 661 } |
662 | 662 |
663 if (status == DemuxerStream::kAborted) { | 663 if (status == DemuxerStream::kAborted) { |
664 if (!read_cb_.is_null()) | 664 if (!read_cb_.is_null()) |
665 SatisfyRead(DEMUXER_READ_ABORTED, NULL); | 665 SatisfyRead(DEMUXER_READ_ABORTED, NULL); |
666 return; | 666 return; |
667 } | 667 } |
668 | 668 |
669 if (!splice_observer_cb_.is_null() && !buffer->end_of_stream()) { | 669 if (!splice_observer_cb_.is_null() && !buffer->end_of_stream()) { |
670 const bool has_splice_ts = buffer->splice_timestamp() != kNoTimestamp(); | 670 const bool has_splice_ts = buffer->splice_timestamp() != kNoTimestamp; |
671 if (active_splice_ || has_splice_ts) { | 671 if (active_splice_ || has_splice_ts) { |
672 splice_observer_cb_.Run(buffer->splice_timestamp()); | 672 splice_observer_cb_.Run(buffer->splice_timestamp()); |
673 active_splice_ = has_splice_ts; | 673 active_splice_ = has_splice_ts; |
674 } | 674 } |
675 } | 675 } |
676 | 676 |
677 DCHECK(status == DemuxerStream::kOk) << status; | 677 DCHECK(status == DemuxerStream::kOk) << status; |
678 Decode(buffer); | 678 Decode(buffer); |
679 | 679 |
680 // Read more data if the decoder supports multiple parallel decoding requests. | 680 // Read more data if the decoder supports multiple parallel decoding requests. |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 } | 784 } |
785 | 785 |
786 // The resetting process will be continued in OnDecoderReinitialized(). | 786 // The resetting process will be continued in OnDecoderReinitialized(). |
787 ReinitializeDecoder(); | 787 ReinitializeDecoder(); |
788 } | 788 } |
789 | 789 |
790 template class DecoderStream<DemuxerStream::VIDEO>; | 790 template class DecoderStream<DemuxerStream::VIDEO>; |
791 template class DecoderStream<DemuxerStream::AUDIO>; | 791 template class DecoderStream<DemuxerStream::AUDIO>; |
792 | 792 |
793 } // namespace media | 793 } // namespace media |
OLD | NEW |