Chromium Code Reviews| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 | 69 |
| 69 // Convert |codec_delay| from nanoseconds into frames. | 70 // Convert |codec_delay| from nanoseconds into frames. |
| 70 int codec_delay_in_frames = 0; | 71 int codec_delay_in_frames = 0; |
| 71 if (codec_delay != -1) { | 72 if (codec_delay != -1) { |
| 72 codec_delay_in_frames = | 73 codec_delay_in_frames = |
| 73 0.5 + | 74 0.5 + |
| 74 samples_per_second * (static_cast<double>(codec_delay) / | 75 samples_per_second * (static_cast<double>(codec_delay) / |
| 75 base::Time::kNanosecondsPerSecond); | 76 base::Time::kNanosecondsPerSecond); |
| 76 } | 77 } |
| 77 | 78 |
| 78 config->Initialize( | 79 config->Initialize(audio_codec, sample_format, channel_layout, |
| 79 audio_codec, | 80 samples_per_second, codec_private, |
| 80 sample_format, | 81 EncryptionScheme(is_encrypted), |
|
ddorwin
2015/12/10 18:36:02
Even here, it might make sense to explicitly say A
dougsteed
2015/12/14 21:19:02
I wasn't aware that WebM was like that. But even s
ddorwin
2016/03/01 02:17:41
I'd rather be explicit than rely on a default, esp
dougsteed
2016/03/02 18:07:52
Done.
| |
| 81 channel_layout, | 82 base::TimeDelta::FromMicroseconds( |
| 82 samples_per_second, | 83 (seek_preroll != -1 ? seek_preroll : 0) / 1000), |
| 83 codec_private, | 84 codec_delay_in_frames); |
| 84 is_encrypted, | |
| 85 base::TimeDelta::FromMicroseconds( | |
| 86 (seek_preroll != -1 ? seek_preroll : 0) / 1000), | |
| 87 codec_delay_in_frames); | |
| 88 return config->IsValidConfig(); | 85 return config->IsValidConfig(); |
| 89 } | 86 } |
| 90 | 87 |
| 91 bool WebMAudioClient::OnUInt(int id, int64 val) { | 88 bool WebMAudioClient::OnUInt(int id, int64 val) { |
| 92 if (id == kWebMIdChannels) { | 89 if (id == kWebMIdChannels) { |
| 93 if (channels_ != -1) { | 90 if (channels_ != -1) { |
| 94 MEDIA_LOG(ERROR, media_log_) << "Multiple values for id " << std::hex | 91 MEDIA_LOG(ERROR, media_log_) << "Multiple values for id " << std::hex |
| 95 << id << " specified. (" << channels_ | 92 << id << " specified. (" << channels_ |
| 96 << " and " << val << ")"; | 93 << " and " << val << ")"; |
| 97 return false; | 94 return false; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 124 << " specified (" << *dst << " and " << val | 121 << " specified (" << *dst << " and " << val |
| 125 << ")"; | 122 << ")"; |
| 126 return false; | 123 return false; |
| 127 } | 124 } |
| 128 | 125 |
| 129 *dst = val; | 126 *dst = val; |
| 130 return true; | 127 return true; |
| 131 } | 128 } |
| 132 | 129 |
| 133 } // namespace media | 130 } // namespace media |
| OLD | NEW |