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" | 12 #include "media/base/video_decoder_config.h" |
13 #include "media/base/video_frame.h" | 13 #include "media/base/video_frame.h" |
14 | 14 |
15 namespace media { | 15 namespace media { |
16 | 16 |
17 std::string DecoderStreamTraits<DemuxerStream::AUDIO>::ToString() { | 17 std::string DecoderStreamTraits<DemuxerStream::AUDIO>::ToString() { |
18 return "audio"; | 18 return "audio"; |
19 } | 19 } |
20 | 20 |
21 void DecoderStreamTraits<DemuxerStream::AUDIO>::Initialize( | 21 void DecoderStreamTraits<DemuxerStream::AUDIO>::InitializeDecoder( |
22 DecoderType* decoder, | 22 DecoderType* decoder, |
23 const DecoderConfigType& config, | 23 DemuxerStream* stream, |
24 bool low_delay, | |
25 const PipelineStatusCB& status_cb, | 24 const PipelineStatusCB& status_cb, |
26 const OutputCB& output_cb) { | 25 const OutputCB& output_cb) { |
27 decoder->Initialize(config, status_cb, output_cb); | 26 DCHECK(stream->audio_decoder_config().IsValidConfig()); |
27 decoder->Initialize(stream->audio_decoder_config(), status_cb, output_cb); | |
wolenetz
2014/11/11 23:48:07
Another double-check: Audio decoders don't care ab
xhwang
2014/11/14 06:38:04
I think it's either not needed, or not implemented
wolenetz
2014/11/14 19:21:58
Acknowledged.
| |
28 } | 28 } |
29 | 29 |
30 void DecoderStreamTraits<DemuxerStream::AUDIO>::ReportStatistics( | 30 void DecoderStreamTraits<DemuxerStream::AUDIO>::ReportStatistics( |
31 const StatisticsCB& statistics_cb, | 31 const StatisticsCB& statistics_cb, |
32 int bytes_decoded) { | 32 int bytes_decoded) { |
33 PipelineStatistics statistics; | 33 PipelineStatistics statistics; |
34 statistics.audio_bytes_decoded = bytes_decoded; | 34 statistics.audio_bytes_decoded = bytes_decoded; |
35 statistics_cb.Run(statistics); | 35 statistics_cb.Run(statistics); |
36 } | 36 } |
37 | 37 |
38 DecoderStreamTraits<DemuxerStream::AUDIO>::DecoderConfigType | |
39 DecoderStreamTraits<DemuxerStream::AUDIO>::GetDecoderConfig( | |
40 DemuxerStream& stream) { | |
41 return stream.audio_decoder_config(); | |
42 } | |
43 | |
44 scoped_refptr<DecoderStreamTraits<DemuxerStream::AUDIO>::OutputType> | 38 scoped_refptr<DecoderStreamTraits<DemuxerStream::AUDIO>::OutputType> |
45 DecoderStreamTraits<DemuxerStream::AUDIO>::CreateEOSOutput() { | 39 DecoderStreamTraits<DemuxerStream::AUDIO>::CreateEOSOutput() { |
46 return OutputType::CreateEOSBuffer(); | 40 return OutputType::CreateEOSBuffer(); |
47 } | 41 } |
48 | 42 |
49 std::string DecoderStreamTraits<DemuxerStream::VIDEO>::ToString() { | 43 std::string DecoderStreamTraits<DemuxerStream::VIDEO>::ToString() { |
50 return "video"; | 44 return "video"; |
51 } | 45 } |
52 | 46 |
53 void DecoderStreamTraits<DemuxerStream::VIDEO>::Initialize( | 47 void DecoderStreamTraits<DemuxerStream::VIDEO>::InitializeDecoder( |
54 DecoderType* decoder, | 48 DecoderType* decoder, |
55 const DecoderConfigType& config, | 49 DemuxerStream* stream, |
56 bool low_delay, | |
57 const PipelineStatusCB& status_cb, | 50 const PipelineStatusCB& status_cb, |
58 const OutputCB& output_cb) { | 51 const OutputCB& output_cb) { |
59 decoder->Initialize(config, low_delay, status_cb, output_cb); | 52 DCHECK(stream->video_decoder_config().IsValidConfig()); |
53 decoder->Initialize(stream->video_decoder_config(), | |
54 stream->liveness() == DemuxerStream::LIVENESS_LIVE, | |
55 status_cb, output_cb); | |
60 } | 56 } |
61 | 57 |
62 bool DecoderStreamTraits<DemuxerStream::VIDEO>::NeedsBitstreamConversion( | 58 bool DecoderStreamTraits<DemuxerStream::VIDEO>::NeedsBitstreamConversion( |
63 DecoderType* decoder) { | 59 DecoderType* decoder) { |
64 return decoder->NeedsBitstreamConversion(); | 60 return decoder->NeedsBitstreamConversion(); |
65 } | 61 } |
66 | 62 |
67 void DecoderStreamTraits<DemuxerStream::VIDEO>::ReportStatistics( | 63 void DecoderStreamTraits<DemuxerStream::VIDEO>::ReportStatistics( |
68 const StatisticsCB& statistics_cb, | 64 const StatisticsCB& statistics_cb, |
69 int bytes_decoded) { | 65 int bytes_decoded) { |
70 PipelineStatistics statistics; | 66 PipelineStatistics statistics; |
71 statistics.video_bytes_decoded = bytes_decoded; | 67 statistics.video_bytes_decoded = bytes_decoded; |
72 statistics_cb.Run(statistics); | 68 statistics_cb.Run(statistics); |
73 } | 69 } |
74 | 70 |
75 DecoderStreamTraits<DemuxerStream::VIDEO>::DecoderConfigType | |
76 DecoderStreamTraits<DemuxerStream::VIDEO>::GetDecoderConfig( | |
77 DemuxerStream& stream) { | |
78 return stream.video_decoder_config(); | |
79 } | |
80 | |
81 scoped_refptr<DecoderStreamTraits<DemuxerStream::VIDEO>::OutputType> | 71 scoped_refptr<DecoderStreamTraits<DemuxerStream::VIDEO>::OutputType> |
82 DecoderStreamTraits<DemuxerStream::VIDEO>::CreateEOSOutput() { | 72 DecoderStreamTraits<DemuxerStream::VIDEO>::CreateEOSOutput() { |
83 return OutputType::CreateEOSFrame(); | 73 return OutputType::CreateEOSFrame(); |
84 } | 74 } |
85 | 75 |
86 } // namespace media | 76 } // namespace media |
OLD | NEW |