OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 AudioEncoderPcm16B::AudioEncoderPcm16B(int payload_type, | 77 AudioEncoderPcm16B::AudioEncoderPcm16B(int payload_type, |
78 const SdpAudioFormat& format) | 78 const SdpAudioFormat& format) |
79 : AudioEncoderPcm16B(CreateConfig(payload_type, format)) {} | 79 : AudioEncoderPcm16B(CreateConfig(payload_type, format)) {} |
80 | 80 |
81 rtc::Optional<AudioCodecInfo> AudioEncoderPcm16B::QueryAudioEncoder( | 81 rtc::Optional<AudioCodecInfo> AudioEncoderPcm16B::QueryAudioEncoder( |
82 const SdpAudioFormat& format) { | 82 const SdpAudioFormat& format) { |
83 if (STR_CASE_CMP(format.name.c_str(), GetPayloadName()) == 0 && | 83 if (STR_CASE_CMP(format.name.c_str(), GetPayloadName()) == 0 && |
84 format.num_channels >= 1) { | 84 format.num_channels >= 1) { |
85 Config config = CreateConfig(0, format); | 85 Config config = CreateConfig(0, format); |
86 if (config.IsOk()) { | 86 if (config.IsOk()) { |
| 87 constexpr int bits_per_sample = 16; |
87 return rtc::Optional<AudioCodecInfo>( | 88 return rtc::Optional<AudioCodecInfo>( |
88 {config.sample_rate_hz, config.num_channels, | 89 {config.sample_rate_hz, config.num_channels, |
89 config.sample_rate_hz * 2 * | 90 config.sample_rate_hz * bits_per_sample * |
90 rtc::dchecked_cast<int>(config.num_channels)}); | 91 rtc::dchecked_cast<int>(config.num_channels)}); |
91 } | 92 } |
92 } | 93 } |
93 return rtc::Optional<AudioCodecInfo>(); | 94 return rtc::Optional<AudioCodecInfo>(); |
94 } | 95 } |
95 | 96 |
96 } // namespace webrtc | 97 } // namespace webrtc |
OLD | NEW |