[chromedriver] Explicitly set page loading state when document.readyState != "complete".
[chromium-blink-merge.git] / media / filters / decoder_stream_traits.cc
blob7583b172b27ad89031ef52892ada8b798e626c44
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_buffer.h"
9 #include "media/base/audio_decoder.h"
10 #include "media/base/audio_decoder_config.h"
11 #include "media/base/video_decoder.h"
12 #include "media/base/video_decoder_config.h"
13 #include "media/base/video_frame.h"
15 namespace media {
17 std::string DecoderStreamTraits<DemuxerStream::AUDIO>::ToString() {
18 return "audio";
21 void DecoderStreamTraits<DemuxerStream::AUDIO>::InitializeDecoder(
22 DecoderType* decoder,
23 DemuxerStream* stream,
24 const InitCB& init_cb,
25 const OutputCB& output_cb) {
26 DCHECK(stream->audio_decoder_config().IsValidConfig());
27 decoder->Initialize(stream->audio_decoder_config(), init_cb, output_cb);
30 void DecoderStreamTraits<DemuxerStream::AUDIO>::ReportStatistics(
31 const StatisticsCB& statistics_cb,
32 int bytes_decoded) {
33 PipelineStatistics statistics;
34 statistics.audio_bytes_decoded = bytes_decoded;
35 statistics_cb.Run(statistics);
38 scoped_refptr<DecoderStreamTraits<DemuxerStream::AUDIO>::OutputType>
39 DecoderStreamTraits<DemuxerStream::AUDIO>::CreateEOSOutput() {
40 return OutputType::CreateEOSBuffer();
43 std::string DecoderStreamTraits<DemuxerStream::VIDEO>::ToString() {
44 return "video";
47 void DecoderStreamTraits<DemuxerStream::VIDEO>::InitializeDecoder(
48 DecoderType* decoder,
49 DemuxerStream* stream,
50 const InitCB& init_cb,
51 const OutputCB& output_cb) {
52 DCHECK(stream->video_decoder_config().IsValidConfig());
53 decoder->Initialize(stream->video_decoder_config(),
54 stream->liveness() == DemuxerStream::LIVENESS_LIVE,
55 init_cb, output_cb);
58 bool DecoderStreamTraits<DemuxerStream::VIDEO>::NeedsBitstreamConversion(
59 DecoderType* decoder) {
60 return decoder->NeedsBitstreamConversion();
63 void DecoderStreamTraits<DemuxerStream::VIDEO>::ReportStatistics(
64 const StatisticsCB& statistics_cb,
65 int bytes_decoded) {
66 PipelineStatistics statistics;
67 statistics.video_bytes_decoded = bytes_decoded;
68 statistics_cb.Run(statistics);
71 scoped_refptr<DecoderStreamTraits<DemuxerStream::VIDEO>::OutputType>
72 DecoderStreamTraits<DemuxerStream::VIDEO>::CreateEOSOutput() {
73 return OutputType::CreateEOSFrame();
76 } // namespace media