OLD | NEW |
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 |
(...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1571 | 1571 |
1572 /* Update the payload limit if the bandwidth is changing. */ | 1572 /* Update the payload limit if the bandwidth is changing. */ |
1573 if (instISAC->bandwidthKHz != bandwidthKHz) { | 1573 if (instISAC->bandwidthKHz != bandwidthKHz) { |
1574 instISAC->bandwidthKHz = bandwidthKHz; | 1574 instISAC->bandwidthKHz = bandwidthKHz; |
1575 UpdatePayloadSizeLimit(instISAC); | 1575 UpdatePayloadSizeLimit(instISAC); |
1576 } | 1576 } |
1577 instISAC->bottleneck = bottleneckBPS; | 1577 instISAC->bottleneck = bottleneckBPS; |
1578 return 0; | 1578 return 0; |
1579 } | 1579 } |
1580 | 1580 |
| 1581 void WebRtcIsac_SetInitialBweBottleneck(ISACStruct* ISAC_main_inst, |
| 1582 int bottleneck_bits_per_second) { |
| 1583 ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst; |
| 1584 assert(bottleneck_bits_per_second >= 10000 && |
| 1585 bottleneck_bits_per_second <= 32000); |
| 1586 instISAC->bwestimator_obj.send_bw_avg = (float)bottleneck_bits_per_second; |
| 1587 } |
1581 | 1588 |
1582 /**************************************************************************** | 1589 /**************************************************************************** |
1583 * WebRtcIsac_ControlBwe(...) | 1590 * WebRtcIsac_ControlBwe(...) |
1584 * | 1591 * |
1585 * This function sets the initial values of bottleneck and frame-size if | 1592 * This function sets the initial values of bottleneck and frame-size if |
1586 * iSAC is used in channel-adaptive mode. Through this API, users can | 1593 * iSAC is used in channel-adaptive mode. Through this API, users can |
1587 * enforce a frame-size for all values of bottleneck. Then iSAC will not | 1594 * enforce a frame-size for all values of bottleneck. Then iSAC will not |
1588 * automatically change the frame-size. | 1595 * automatically change the frame-size. |
1589 * | 1596 * |
1590 * | 1597 * |
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2392 WebRtcIsacBw_GetBandwidthInfo(&instISAC->bwestimator_obj, | 2399 WebRtcIsacBw_GetBandwidthInfo(&instISAC->bwestimator_obj, |
2393 instISAC->decoderSamplingRateKHz, bwinfo); | 2400 instISAC->decoderSamplingRateKHz, bwinfo); |
2394 } | 2401 } |
2395 | 2402 |
2396 void WebRtcIsac_SetBandwidthInfo(ISACStruct* inst, | 2403 void WebRtcIsac_SetBandwidthInfo(ISACStruct* inst, |
2397 const IsacBandwidthInfo* bwinfo) { | 2404 const IsacBandwidthInfo* bwinfo) { |
2398 ISACMainStruct* instISAC = (ISACMainStruct*)inst; | 2405 ISACMainStruct* instISAC = (ISACMainStruct*)inst; |
2399 assert(instISAC->initFlag & BIT_MASK_ENC_INIT); | 2406 assert(instISAC->initFlag & BIT_MASK_ENC_INIT); |
2400 WebRtcIsacBw_SetBandwidthInfo(&instISAC->bwestimator_obj, bwinfo); | 2407 WebRtcIsacBw_SetBandwidthInfo(&instISAC->bwestimator_obj, bwinfo); |
2401 } | 2408 } |
| 2409 |
| 2410 void WebRtcIsac_SetEncSampRateInDecoder(ISACStruct* inst, |
| 2411 int sample_rate_hz) { |
| 2412 ISACMainStruct* instISAC = (ISACMainStruct*)inst; |
| 2413 assert(instISAC->initFlag & BIT_MASK_DEC_INIT); |
| 2414 assert(!(instISAC->initFlag & BIT_MASK_ENC_INIT)); |
| 2415 assert(sample_rate_hz == 16000 || sample_rate_hz == 32000); |
| 2416 instISAC->encoderSamplingRateKHz = sample_rate_hz / 1000; |
| 2417 } |
OLD | NEW |