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/formats/webm/webm_audio_client.h" | 5 #include "media/formats/webm/webm_audio_client.h" |
6 | 6 |
7 #include "media/base/audio_decoder_config.h" | 7 #include "media/base/audio_decoder_config.h" |
8 #include "media/base/channel_layout.h" | 8 #include "media/base/channel_layout.h" |
9 #include "media/base/encryption_scheme.h" | |
9 #include "media/formats/webm/webm_constants.h" | 10 #include "media/formats/webm/webm_constants.h" |
10 | 11 |
11 namespace media { | 12 namespace media { |
12 | 13 |
13 WebMAudioClient::WebMAudioClient(const scoped_refptr<MediaLog>& media_log) | 14 WebMAudioClient::WebMAudioClient(const scoped_refptr<MediaLog>& media_log) |
14 : media_log_(media_log) { | 15 : media_log_(media_log) { |
15 Reset(); | 16 Reset(); |
16 } | 17 } |
17 | 18 |
18 WebMAudioClient::~WebMAudioClient() { | 19 WebMAudioClient::~WebMAudioClient() { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 | 72 |
72 // Convert |codec_delay| from nanoseconds into frames. | 73 // Convert |codec_delay| from nanoseconds into frames. |
73 int codec_delay_in_frames = 0; | 74 int codec_delay_in_frames = 0; |
74 if (codec_delay != -1) { | 75 if (codec_delay != -1) { |
75 codec_delay_in_frames = | 76 codec_delay_in_frames = |
76 0.5 + | 77 0.5 + |
77 samples_per_second * (static_cast<double>(codec_delay) / | 78 samples_per_second * (static_cast<double>(codec_delay) / |
78 base::Time::kNanosecondsPerSecond); | 79 base::Time::kNanosecondsPerSecond); |
79 } | 80 } |
80 | 81 |
81 config->Initialize( | 82 config->Initialize(audio_codec, sample_format, channel_layout, |
82 audio_codec, | 83 samples_per_second, codec_private, |
83 sample_format, | 84 EncryptionScheme(is_encrypted), |
ddorwin
2016/03/01 02:17:42
WebM is always CTR no pattern.
dougsteed
2016/03/02 18:07:53
Done.
| |
84 channel_layout, | 85 base::TimeDelta::FromMicroseconds( |
85 samples_per_second, | 86 (seek_preroll != -1 ? seek_preroll : 0) / 1000), |
86 codec_private, | 87 codec_delay_in_frames); |
87 is_encrypted, | |
88 base::TimeDelta::FromMicroseconds( | |
89 (seek_preroll != -1 ? seek_preroll : 0) / 1000), | |
90 codec_delay_in_frames); | |
91 return config->IsValidConfig(); | 88 return config->IsValidConfig(); |
92 } | 89 } |
93 | 90 |
94 bool WebMAudioClient::OnUInt(int id, int64_t val) { | 91 bool WebMAudioClient::OnUInt(int id, int64_t val) { |
95 if (id == kWebMIdChannels) { | 92 if (id == kWebMIdChannels) { |
96 if (channels_ != -1) { | 93 if (channels_ != -1) { |
97 MEDIA_LOG(ERROR, media_log_) << "Multiple values for id " << std::hex | 94 MEDIA_LOG(ERROR, media_log_) << "Multiple values for id " << std::hex |
98 << id << " specified. (" << channels_ | 95 << id << " specified. (" << channels_ |
99 << " and " << val << ")"; | 96 << " and " << val << ")"; |
100 return false; | 97 return false; |
(...skipping 26 matching lines...) Expand all Loading... | |
127 << " specified (" << *dst << " and " << val | 124 << " specified (" << *dst << " and " << val |
128 << ")"; | 125 << ")"; |
129 return false; | 126 return false; |
130 } | 127 } |
131 | 128 |
132 *dst = val; | 129 *dst = val; |
133 return true; | 130 return true; |
134 } | 131 } |
135 | 132 |
136 } // namespace media | 133 } // namespace media |
OLD | NEW |