Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: webrtc/api/audio_codecs/isac/audio_encoder_isac_fix.cc

Issue 2996693002: iSAC fixed-point implementation of the Audio{En,De}coderFactoryTemplate APIs (Closed)
Patch Set: review comments Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/api/audio_codecs/isac/audio_encoder_isac_fix.h"
12
13 #include "webrtc/common_types.h"
14 #include "webrtc/modules/audio_coding/codecs/isac/fix/include/audio_encoder_isac fix.h"
15 #include "webrtc/rtc_base/ptr_util.h"
16 #include "webrtc/rtc_base/string_to_number.h"
17
18 namespace webrtc {
19
20 rtc::Optional<AudioEncoderIsacFix::Config> AudioEncoderIsacFix::SdpToConfig(
21 const SdpAudioFormat& format) {
22 if (STR_CASE_CMP(format.name.c_str(), "ISAC") == 0 &&
ossu 2017/08/18 10:19:59 Does this mean we'll eventually be removing Create
kwiberg-webrtc 2017/08/18 10:47:21 Yes, because the code over there will no longer ne
23 format.clockrate_hz == 16000 && format.num_channels == 1) {
24 Config config;
25 const auto ptime_iter = format.parameters.find("ptime");
26 if (ptime_iter != format.parameters.end()) {
27 const auto ptime = rtc::StringToNumber<int>(ptime_iter->second);
28 if (ptime && *ptime >= 60) {
29 config.frame_size_ms = 60;
30 }
31 }
32 return rtc::Optional<Config>(config);
33 } else {
34 return rtc::Optional<Config>();
35 }
36 }
37
38 void AudioEncoderIsacFix::AppendSupportedEncoders(
39 std::vector<AudioCodecSpec>* specs) {
40 const SdpAudioFormat fmt = {"ISAC", 16000, 1};
41 const AudioCodecInfo info = QueryAudioEncoder(*SdpToConfig(fmt));
42 specs->push_back({fmt, info});
43 }
44
45 AudioCodecInfo AudioEncoderIsacFix::QueryAudioEncoder(
46 AudioEncoderIsacFix::Config config) {
47 RTC_DCHECK(config.IsOk());
48 return {16000, 1, 32000, 10000, 32000};
49 }
50
51 std::unique_ptr<AudioEncoder> AudioEncoderIsacFix::MakeAudioEncoder(
52 AudioEncoderIsacFix::Config config,
53 int payload_type) {
54 RTC_DCHECK(config.IsOk());
55 AudioEncoderIsacFixImpl::Config c;
56 c.frame_size_ms = config.frame_size_ms;
57 c.payload_type = payload_type;
58 return rtc::MakeUnique<AudioEncoderIsacFixImpl>(c);
59 }
60
61 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/audio_codecs/isac/audio_encoder_isac_fix.h ('k') | webrtc/api/audio_codecs/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698