| 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 |
| 11 #include "webrtc/modules/audio_coding/codecs/g722/include/audio_encoder_g722.h" | 11 #include "webrtc/modules/audio_coding/codecs/g722/include/audio_encoder_g722.h" |
| 12 | 12 |
| 13 #include <limits> | 13 #include <limits> |
| 14 #include "webrtc/base/checks.h" | 14 #include "webrtc/base/checks.h" |
| 15 #include "webrtc/common_types.h" | 15 #include "webrtc/common_types.h" |
| 16 #include "webrtc/modules/audio_coding/codecs/g722/include/g722_interface.h" | 16 #include "webrtc/modules/audio_coding/codecs/g722/include/g722_interface.h" |
| 17 | 17 |
| 18 namespace webrtc { | 18 namespace webrtc { |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 const int kSampleRateHz = 16000; | 22 const int kSampleRateHz = 16000; |
| 23 | 23 |
| 24 } // namespace | 24 } // namespace |
| 25 | 25 |
| 26 bool AudioEncoderG722::Config::IsOk() const { | 26 bool AudioEncoderG722::Config::IsOk() const { |
| 27 return (frame_size_ms % 10 == 0) && (num_channels >= 1); | 27 return (frame_size_ms > 0) && (frame_size_ms % 10 == 0) && |
| 28 (num_channels >= 1); |
| 28 } | 29 } |
| 29 | 30 |
| 30 AudioEncoderG722::EncoderState::EncoderState() { | 31 AudioEncoderG722::EncoderState::EncoderState() { |
| 31 CHECK_EQ(0, WebRtcG722_CreateEncoder(&encoder)); | 32 CHECK_EQ(0, WebRtcG722_CreateEncoder(&encoder)); |
| 32 CHECK_EQ(0, WebRtcG722_EncoderInit(encoder)); | 33 CHECK_EQ(0, WebRtcG722_EncoderInit(encoder)); |
| 33 } | 34 } |
| 34 | 35 |
| 35 AudioEncoderG722::EncoderState::~EncoderState() { | 36 AudioEncoderG722::EncoderState::~EncoderState() { |
| 36 CHECK_EQ(0, WebRtcG722_FreeEncoder(encoder)); | 37 CHECK_EQ(0, WebRtcG722_FreeEncoder(encoder)); |
| 37 } | 38 } |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 config.payload_type = codec_inst.pltype; | 147 config.payload_type = codec_inst.pltype; |
| 147 return config; | 148 return config; |
| 148 } | 149 } |
| 149 } // namespace | 150 } // namespace |
| 150 | 151 |
| 151 AudioEncoderMutableG722::AudioEncoderMutableG722(const CodecInst& codec_inst) | 152 AudioEncoderMutableG722::AudioEncoderMutableG722(const CodecInst& codec_inst) |
| 152 : AudioEncoderMutableImpl<AudioEncoderG722>(CreateConfig(codec_inst)) { | 153 : AudioEncoderMutableImpl<AudioEncoderG722>(CreateConfig(codec_inst)) { |
| 153 } | 154 } |
| 154 | 155 |
| 155 } // namespace webrtc | 156 } // namespace webrtc |
| OLD | NEW |