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_decoder.h" | |
9 #include "media/base/audio_decoder_config.h" | |
8 #include "media/base/video_decoder.h" | 10 #include "media/base/video_decoder.h" |
11 #include "media/base/video_decoder_config.h" | |
9 | 12 |
10 namespace media { | 13 namespace media { |
11 | 14 |
15 bool DecoderStreamTraits<DemuxerStream::AUDIO>::FinishInitialization( | |
16 const StreamInitCB& init_cb, | |
17 DecoderType* decoder, | |
18 DemuxerStream* stream) { | |
19 DCHECK(stream); | |
20 if (!decoder) { | |
21 init_cb.Run(false); | |
22 return false; | |
23 } | |
24 init_cb.Run(true); | |
25 return true; | |
26 } | |
27 | |
28 void DecoderStreamTraits<DemuxerStream::AUDIO>::ReportStatistics( | |
DaleCurtis
2014/03/04 01:01:33
Both AUDIO and VIDEO seem to have the same functio
rileya (GONE FROM CHROMIUM)
2014/03/04 02:03:01
Unfortunately AUDIO uses "statistics.audio_bytes_d
| |
29 const StatisticsCB& statistics_cb, | |
30 int bytes_decoded) { | |
31 PipelineStatistics statistics; | |
32 statistics.audio_bytes_decoded = bytes_decoded; | |
33 statistics_cb.Run(statistics); | |
34 } | |
35 | |
36 DecoderStreamTraits<DemuxerStream::AUDIO>::DecoderConfigType | |
37 DecoderStreamTraits<DemuxerStream::AUDIO>::GetDecoderConfig( | |
38 DemuxerStream& stream) { | |
39 return stream.audio_decoder_config(); | |
40 } | |
41 | |
12 bool DecoderStreamTraits<DemuxerStream::VIDEO>::FinishInitialization( | 42 bool DecoderStreamTraits<DemuxerStream::VIDEO>::FinishInitialization( |
13 const StreamInitCB& init_cb, | 43 const StreamInitCB& init_cb, |
14 DecoderType* decoder, | 44 DecoderType* decoder, |
15 DemuxerStream* stream) { | 45 DemuxerStream* stream) { |
16 DCHECK(stream); | 46 DCHECK(stream); |
17 if (!decoder) { | 47 if (!decoder) { |
18 init_cb.Run(false, false); | 48 init_cb.Run(false, false); |
19 return false; | 49 return false; |
20 } | 50 } |
21 if (decoder->NeedsBitstreamConversion()) | 51 if (decoder->NeedsBitstreamConversion()) |
22 stream->EnableBitstreamConverter(); | 52 stream->EnableBitstreamConverter(); |
23 // TODO(xhwang): We assume |decoder_->HasAlpha()| does not change after | 53 // TODO(xhwang): We assume |decoder_->HasAlpha()| does not change after |
24 // reinitialization. Check this condition. | 54 // reinitialization. Check this condition. |
25 init_cb.Run(true, decoder->HasAlpha()); | 55 init_cb.Run(true, decoder->HasAlpha()); |
26 return true; | 56 return true; |
27 } | 57 } |
28 | 58 |
29 void DecoderStreamTraits<DemuxerStream::VIDEO>::ReportStatistics( | 59 void DecoderStreamTraits<DemuxerStream::VIDEO>::ReportStatistics( |
30 const StatisticsCB& statistics_cb, | 60 const StatisticsCB& statistics_cb, |
31 int bytes_decoded) { | 61 int bytes_decoded) { |
32 PipelineStatistics statistics; | 62 PipelineStatistics statistics; |
33 statistics.video_bytes_decoded = bytes_decoded; | 63 statistics.video_bytes_decoded = bytes_decoded; |
34 statistics_cb.Run(statistics); | 64 statistics_cb.Run(statistics); |
35 } | 65 } |
36 | 66 |
67 DecoderStreamTraits<DemuxerStream::VIDEO>::DecoderConfigType | |
68 DecoderStreamTraits<DemuxerStream::VIDEO>::GetDecoderConfig( | |
69 DemuxerStream& stream) { | |
70 return stream.video_decoder_config(); | |
71 } | |
72 | |
37 } // namespace media | 73 } // namespace media |
OLD | NEW |