| 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/formats/webm/webm_constants.h" | 9 #include "media/formats/webm/webm_constants.h" |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 if (channel_layout == CHANNEL_LAYOUT_UNSUPPORTED) { | 52 if (channel_layout == CHANNEL_LAYOUT_UNSUPPORTED) { |
| 53 MEDIA_LOG(log_cb_) << "Unsupported channel count " << channels_; | 53 MEDIA_LOG(log_cb_) << "Unsupported channel count " << channels_; |
| 54 return false; | 54 return false; |
| 55 } | 55 } |
| 56 | 56 |
| 57 int samples_per_second = samples_per_second_; | 57 int samples_per_second = samples_per_second_; |
| 58 if (output_samples_per_second_ > 0) | 58 if (output_samples_per_second_ > 0) |
| 59 samples_per_second = output_samples_per_second_; | 59 samples_per_second = output_samples_per_second_; |
| 60 | 60 |
| 61 // Always use 48kHz for OPUS. See the "Input Sample Rate" section of the |
| 62 // spec: http://tools.ietf.org/html/draft-terriberry-oggopus-01#page-11 |
| 63 if (audio_codec == kCodecOpus) |
| 64 samples_per_second = 48000; |
| 65 |
| 61 const uint8* extra_data = NULL; | 66 const uint8* extra_data = NULL; |
| 62 size_t extra_data_size = 0; | 67 size_t extra_data_size = 0; |
| 63 if (codec_private.size() > 0) { | 68 if (codec_private.size() > 0) { |
| 64 extra_data = &codec_private[0]; | 69 extra_data = &codec_private[0]; |
| 65 extra_data_size = codec_private.size(); | 70 extra_data_size = codec_private.size(); |
| 66 } | 71 } |
| 67 | 72 |
| 68 // Convert |codec_delay| from nanoseconds into frames. | 73 // Convert |codec_delay| from nanoseconds into frames. |
| 69 int codec_delay_in_frames = 0; | 74 int codec_delay_in_frames = 0; |
| 70 if (codec_delay != -1) { | 75 if (codec_delay != -1) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 MEDIA_LOG(log_cb_) << "Multiple values for id " << std::hex << id | 129 MEDIA_LOG(log_cb_) << "Multiple values for id " << std::hex << id |
| 125 << " specified (" << *dst << " and " << val << ")"; | 130 << " specified (" << *dst << " and " << val << ")"; |
| 126 return false; | 131 return false; |
| 127 } | 132 } |
| 128 | 133 |
| 129 *dst = val; | 134 *dst = val; |
| 130 return true; | 135 return true; |
| 131 } | 136 } |
| 132 | 137 |
| 133 } // namespace media | 138 } // namespace media |
| OLD | NEW |