Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / media / filters / decoder_stream_traits.cc
blobce79ddd4b48d439ebaf24b5347195ba2c0bbe516
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
3 // found in the LICENSE file.
5 #include "media/filters/decoder_stream_traits.h"
7 #include "base/logging.h"
8 #include "media/base/audio_decoder.h"
9 #include "media/base/audio_decoder_config.h"
10 #include "media/base/video_decoder.h"
11 #include "media/base/video_decoder_config.h"
13 namespace media {
15 std::string DecoderStreamTraits<DemuxerStream::AUDIO>::ToString() {
16 return "Audio";
19 void DecoderStreamTraits<DemuxerStream::AUDIO>::Initialize(
20 DecoderType* decoder,
21 const DecoderConfigType& config,
22 bool low_delay,
23 const PipelineStatusCB& status_cb) {
24 decoder->Initialize(config, status_cb);
27 bool DecoderStreamTraits<DemuxerStream::AUDIO>::FinishInitialization(
28 const StreamInitCB& init_cb,
29 DecoderType* decoder,
30 DemuxerStream* stream) {
31 DCHECK(stream);
32 if (!decoder) {
33 init_cb.Run(false);
34 return false;
36 init_cb.Run(true);
37 return true;
40 void DecoderStreamTraits<DemuxerStream::AUDIO>::ReportStatistics(
41 const StatisticsCB& statistics_cb,
42 int bytes_decoded) {
43 PipelineStatistics statistics;
44 statistics.audio_bytes_decoded = bytes_decoded;
45 statistics_cb.Run(statistics);
48 DecoderStreamTraits<DemuxerStream::AUDIO>::DecoderConfigType
49 DecoderStreamTraits<DemuxerStream::AUDIO>::GetDecoderConfig(
50 DemuxerStream& stream) {
51 return stream.audio_decoder_config();
54 std::string DecoderStreamTraits<DemuxerStream::VIDEO>::ToString() {
55 return "Video";
58 void DecoderStreamTraits<DemuxerStream::VIDEO>::Initialize(
59 DecoderType* decoder,
60 const DecoderConfigType& config,
61 bool low_delay,
62 const PipelineStatusCB& status_cb) {
63 decoder->Initialize(config, low_delay, status_cb);
66 bool DecoderStreamTraits<DemuxerStream::VIDEO>::FinishInitialization(
67 const StreamInitCB& init_cb,
68 DecoderType* decoder,
69 DemuxerStream* stream) {
70 DCHECK(stream);
71 if (!decoder) {
72 init_cb.Run(false);
73 return false;
75 if (decoder->NeedsBitstreamConversion())
76 stream->EnableBitstreamConverter();
77 init_cb.Run(true);
78 return true;
81 void DecoderStreamTraits<DemuxerStream::VIDEO>::ReportStatistics(
82 const StatisticsCB& statistics_cb,
83 int bytes_decoded) {
84 PipelineStatistics statistics;
85 statistics.video_bytes_decoded = bytes_decoded;
86 statistics_cb.Run(statistics);
89 DecoderStreamTraits<DemuxerStream::VIDEO>::DecoderConfigType
90 DecoderStreamTraits<DemuxerStream::VIDEO>::GetDecoderConfig(
91 DemuxerStream& stream) {
92 return stream.video_decoder_config();
95 } // namespace media