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

Side by Side Diff: webrtc/modules/audio_coding/codecs/isac/main/source/isac.c

Issue 2274083002: Replace calls to assert() with RTC_DCHECK_*() in .c code (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 4 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
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 /* 11 /*
12 * isac.c 12 * isac.c
13 * 13 *
14 * This C file contains the functions for the ISAC API 14 * This C file contains the functions for the ISAC API
15 * 15 *
16 */ 16 */
17 17
18 #include "webrtc/modules/audio_coding/codecs/isac/main/include/isac.h" 18 #include "webrtc/modules/audio_coding/codecs/isac/main/include/isac.h"
19 19
20 #include <assert.h>
21 #include <math.h> 20 #include <math.h>
22 #include <stdio.h> 21 #include <stdio.h>
23 #include <stdlib.h> 22 #include <stdlib.h>
24 #include <string.h> 23 #include <string.h>
25 24
25 #include "webrtc/base/checks.h"
26 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar y.h" 26 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar y.h"
27 #include "webrtc/modules/audio_coding/codecs/isac/main/source/bandwidth_estimato r.h" 27 #include "webrtc/modules/audio_coding/codecs/isac/main/source/bandwidth_estimato r.h"
28 #include "webrtc/modules/audio_coding/codecs/isac/main/source/codec.h" 28 #include "webrtc/modules/audio_coding/codecs/isac/main/source/codec.h"
29 #include "webrtc/modules/audio_coding/codecs/isac/main/source/crc.h" 29 #include "webrtc/modules/audio_coding/codecs/isac/main/source/crc.h"
30 #include "webrtc/modules/audio_coding/codecs/isac/main/source/entropy_coding.h" 30 #include "webrtc/modules/audio_coding/codecs/isac/main/source/entropy_coding.h"
31 #include "webrtc/modules/audio_coding/codecs/isac/main/source/lpc_shape_swb16_ta bles.h" 31 #include "webrtc/modules/audio_coding/codecs/isac/main/source/lpc_shape_swb16_ta bles.h"
32 #include "webrtc/modules/audio_coding/codecs/isac/main/source/os_specific_inline .h" 32 #include "webrtc/modules/audio_coding/codecs/isac/main/source/os_specific_inline .h"
33 #include "webrtc/modules/audio_coding/codecs/isac/main/source/structs.h" 33 #include "webrtc/modules/audio_coding/codecs/isac/main/source/structs.h"
34 34
35 #define BIT_MASK_DEC_INIT 0x0001 35 #define BIT_MASK_DEC_INIT 0x0001
(...skipping 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after
1532 instISAC->bandwidthKHz = bandwidthKHz; 1532 instISAC->bandwidthKHz = bandwidthKHz;
1533 UpdatePayloadSizeLimit(instISAC); 1533 UpdatePayloadSizeLimit(instISAC);
1534 } 1534 }
1535 instISAC->bottleneck = bottleneckBPS; 1535 instISAC->bottleneck = bottleneckBPS;
1536 return 0; 1536 return 0;
1537 } 1537 }
1538 1538
1539 void WebRtcIsac_SetInitialBweBottleneck(ISACStruct* ISAC_main_inst, 1539 void WebRtcIsac_SetInitialBweBottleneck(ISACStruct* ISAC_main_inst,
1540 int bottleneck_bits_per_second) { 1540 int bottleneck_bits_per_second) {
1541 ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst; 1541 ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
1542 assert(bottleneck_bits_per_second >= 10000 && 1542 RTC_DCHECK_GE(bottleneck_bits_per_second, 10000);
1543 bottleneck_bits_per_second <= 32000); 1543 RTC_DCHECK_LE(bottleneck_bits_per_second, 32000);
1544 instISAC->bwestimator_obj.send_bw_avg = (float)bottleneck_bits_per_second; 1544 instISAC->bwestimator_obj.send_bw_avg = (float)bottleneck_bits_per_second;
1545 } 1545 }
1546 1546
1547 /**************************************************************************** 1547 /****************************************************************************
1548 * WebRtcIsac_ControlBwe(...) 1548 * WebRtcIsac_ControlBwe(...)
1549 * 1549 *
1550 * This function sets the initial values of bottleneck and frame-size if 1550 * This function sets the initial values of bottleneck and frame-size if
1551 * iSAC is used in channel-adaptive mode. Through this API, users can 1551 * iSAC is used in channel-adaptive mode. Through this API, users can
1552 * enforce a frame-size for all values of bottleneck. Then iSAC will not 1552 * enforce a frame-size for all values of bottleneck. Then iSAC will not
1553 * automatically change the frame-size. 1553 * automatically change the frame-size.
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
2334 * 2334 *
2335 */ 2335 */
2336 uint16_t WebRtcIsac_DecSampRate(ISACStruct* ISAC_main_inst) { 2336 uint16_t WebRtcIsac_DecSampRate(ISACStruct* ISAC_main_inst) {
2337 ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst; 2337 ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
2338 return instISAC->decoderSamplingRateKHz == kIsacWideband ? 16000 : 32000; 2338 return instISAC->decoderSamplingRateKHz == kIsacWideband ? 16000 : 32000;
2339 } 2339 }
2340 2340
2341 void WebRtcIsac_GetBandwidthInfo(ISACStruct* inst, 2341 void WebRtcIsac_GetBandwidthInfo(ISACStruct* inst,
2342 IsacBandwidthInfo* bwinfo) { 2342 IsacBandwidthInfo* bwinfo) {
2343 ISACMainStruct* instISAC = (ISACMainStruct*)inst; 2343 ISACMainStruct* instISAC = (ISACMainStruct*)inst;
2344 assert(instISAC->initFlag & BIT_MASK_DEC_INIT); 2344 RTC_DCHECK_NE(0, instISAC->initFlag & BIT_MASK_DEC_INIT);
2345 WebRtcIsacBw_GetBandwidthInfo(&instISAC->bwestimator_obj, 2345 WebRtcIsacBw_GetBandwidthInfo(&instISAC->bwestimator_obj,
2346 instISAC->decoderSamplingRateKHz, bwinfo); 2346 instISAC->decoderSamplingRateKHz, bwinfo);
2347 } 2347 }
2348 2348
2349 void WebRtcIsac_SetBandwidthInfo(ISACStruct* inst, 2349 void WebRtcIsac_SetBandwidthInfo(ISACStruct* inst,
2350 const IsacBandwidthInfo* bwinfo) { 2350 const IsacBandwidthInfo* bwinfo) {
2351 ISACMainStruct* instISAC = (ISACMainStruct*)inst; 2351 ISACMainStruct* instISAC = (ISACMainStruct*)inst;
2352 assert(instISAC->initFlag & BIT_MASK_ENC_INIT); 2352 RTC_DCHECK_NE(0, instISAC->initFlag & BIT_MASK_ENC_INIT);
2353 WebRtcIsacBw_SetBandwidthInfo(&instISAC->bwestimator_obj, bwinfo); 2353 WebRtcIsacBw_SetBandwidthInfo(&instISAC->bwestimator_obj, bwinfo);
2354 } 2354 }
2355 2355
2356 void WebRtcIsac_SetEncSampRateInDecoder(ISACStruct* inst, 2356 void WebRtcIsac_SetEncSampRateInDecoder(ISACStruct* inst,
2357 int sample_rate_hz) { 2357 int sample_rate_hz) {
2358 ISACMainStruct* instISAC = (ISACMainStruct*)inst; 2358 ISACMainStruct* instISAC = (ISACMainStruct*)inst;
2359 assert(instISAC->initFlag & BIT_MASK_DEC_INIT); 2359 RTC_DCHECK_NE(0, instISAC->initFlag & BIT_MASK_DEC_INIT);
2360 assert(!(instISAC->initFlag & BIT_MASK_ENC_INIT)); 2360 RTC_DCHECK(!(instISAC->initFlag & BIT_MASK_ENC_INIT));
2361 assert(sample_rate_hz == 16000 || sample_rate_hz == 32000); 2361 RTC_DCHECK(sample_rate_hz == 16000 || sample_rate_hz == 32000);
2362 instISAC->encoderSamplingRateKHz = sample_rate_hz / 1000; 2362 instISAC->encoderSamplingRateKHz = sample_rate_hz / 1000;
2363 } 2363 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698