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_traits.h" | 5 #include "media/filters/decoder_stream_traits.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "media/base/audio_buffer.h" | 8 #include "media/base/audio_buffer.h" |
9 #include "media/base/audio_decoder.h" | 9 #include "media/base/audio_decoder.h" |
10 #include "media/base/audio_decoder_config.h" | 10 #include "media/base/audio_decoder_config.h" |
11 #include "media/base/video_decoder.h" | 11 #include "media/base/video_decoder.h" |
12 #include "media/base/video_decoder_config.h" | |
13 #include "media/base/video_frame.h" | 12 #include "media/base/video_frame.h" |
14 | 13 |
15 namespace media { | 14 namespace media { |
16 | 15 |
17 std::string DecoderStreamTraits<DemuxerStream::AUDIO>::ToString() { | 16 std::string DecoderStreamTraits<DemuxerStream::AUDIO>::ToString() { |
18 return "audio"; | 17 return "audio"; |
19 } | 18 } |
20 | 19 |
21 void DecoderStreamTraits<DemuxerStream::AUDIO>::InitializeDecoder( | 20 void DecoderStreamTraits<DemuxerStream::AUDIO>::InitializeDecoder( |
22 DecoderType* decoder, | 21 DecoderType* decoder, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 PipelineStatistics statistics; | 73 PipelineStatistics statistics; |
75 statistics.video_bytes_decoded = bytes_decoded; | 74 statistics.video_bytes_decoded = bytes_decoded; |
76 statistics_cb.Run(statistics); | 75 statistics_cb.Run(statistics); |
77 } | 76 } |
78 | 77 |
79 scoped_refptr<DecoderStreamTraits<DemuxerStream::VIDEO>::OutputType> | 78 scoped_refptr<DecoderStreamTraits<DemuxerStream::VIDEO>::OutputType> |
80 DecoderStreamTraits<DemuxerStream::VIDEO>::CreateEOSOutput() { | 79 DecoderStreamTraits<DemuxerStream::VIDEO>::CreateEOSOutput() { |
81 return OutputType::CreateEOSFrame(); | 80 return OutputType::CreateEOSFrame(); |
82 } | 81 } |
83 | 82 |
| 83 DecoderStreamTraits<DemuxerStream::AUDIO>::DecoderStreamTraits( |
| 84 const scoped_refptr<MediaLog>& media_log) |
| 85 : media_log_(media_log) {} |
| 86 |
| 87 void DecoderStreamTraits<DemuxerStream::AUDIO>::OnStreamReset( |
| 88 DemuxerStream* stream) { |
| 89 DCHECK(stream); |
| 90 // Stream is likely being seeked to a new timestamp, so make new validator to |
| 91 // build new timestamp expectations. |
| 92 audio_ts_validator_.reset( |
| 93 new AudioTimestampValidator(stream->audio_decoder_config(), media_log_)); |
| 94 } |
| 95 |
| 96 void DecoderStreamTraits<DemuxerStream::AUDIO>::OnDecode( |
| 97 const scoped_refptr<DecoderBuffer>& buffer) { |
| 98 audio_ts_validator_->CheckForTimestampGap(buffer); |
| 99 } |
| 100 |
| 101 void DecoderStreamTraits<DemuxerStream::AUDIO>::OnDecodeDone( |
| 102 const scoped_refptr<OutputType>& buffer) { |
| 103 audio_ts_validator_->RecordOutputDuration(buffer); |
| 104 } |
| 105 |
| 106 template class DecoderStreamTraits<DemuxerStream::VIDEO>; |
| 107 template class DecoderStreamTraits<DemuxerStream::AUDIO>; |
| 108 |
84 } // namespace media | 109 } // namespace media |
OLD | NEW |