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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 // true if the parameters are valid, | 187 // true if the parameters are valid, |
188 // false if any parameter is not valid. | 188 // false if any parameter is not valid. |
189 // | 189 // |
190 static bool IsCodecValid(const CodecInst& codec); | 190 static bool IsCodecValid(const CodecInst& codec); |
191 | 191 |
192 /////////////////////////////////////////////////////////////////////////// | 192 /////////////////////////////////////////////////////////////////////////// |
193 // Sender | 193 // Sender |
194 // | 194 // |
195 | 195 |
196 /////////////////////////////////////////////////////////////////////////// | 196 /////////////////////////////////////////////////////////////////////////// |
197 // int32_t ResetEncoder() | |
198 // This API resets the states of encoder. All the encoder settings, such as | |
199 // send-codec or VAD/DTX, will be preserved. | |
200 // | |
201 // Return value: | |
202 // -1 if failed to initialize, | |
203 // 0 if succeeded. | |
204 // | |
205 virtual int32_t ResetEncoder() = 0; | |
206 | |
207 /////////////////////////////////////////////////////////////////////////// | |
208 // int32_t RegisterSendCodec() | 197 // int32_t RegisterSendCodec() |
209 // Registers a codec, specified by |send_codec|, as sending codec. | 198 // Registers a codec, specified by |send_codec|, as sending codec. |
210 // This API can be called multiple of times to register Codec. The last codec | 199 // This API can be called multiple of times to register Codec. The last codec |
211 // registered overwrites the previous ones. | 200 // registered overwrites the previous ones. |
212 // The API can also be used to change payload type for CNG and RED, which are | 201 // The API can also be used to change payload type for CNG and RED, which are |
213 // registered by default to default payload types. | 202 // registered by default to default payload types. |
214 // Note that registering CNG and RED won't overwrite speech codecs. | 203 // Note that registering CNG and RED won't overwrite speech codecs. |
215 // This API can be called to set/change the send payload-type, frame-size | 204 // This API can be called to set/change the send payload-type, frame-size |
216 // or encoding rate (if applicable for the codec). | 205 // or encoding rate (if applicable for the codec). |
217 // | 206 // |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 // int32_t SendFrequency() | 244 // int32_t SendFrequency() |
256 // Get the sampling frequency of the current encoder in Hertz. | 245 // Get the sampling frequency of the current encoder in Hertz. |
257 // | 246 // |
258 // Return value: | 247 // Return value: |
259 // positive; sampling frequency [Hz] of the current encoder. | 248 // positive; sampling frequency [Hz] of the current encoder. |
260 // -1 if an error has happened. | 249 // -1 if an error has happened. |
261 // | 250 // |
262 virtual int32_t SendFrequency() const = 0; | 251 virtual int32_t SendFrequency() const = 0; |
263 | 252 |
264 /////////////////////////////////////////////////////////////////////////// | 253 /////////////////////////////////////////////////////////////////////////// |
265 // int32_t Bitrate() | |
266 // Get encoding bit-rate in bits per second. | |
267 // | |
268 // Return value: | |
269 // positive; encoding rate in bits/sec, | |
270 // -1 if an error is happened. | |
271 // | |
272 virtual int32_t SendBitrate() const = 0; | |
273 | |
274 /////////////////////////////////////////////////////////////////////////// | |
275 // Sets the bitrate to the specified value in bits/sec. If the value is not | 254 // Sets the bitrate to the specified value in bits/sec. If the value is not |
276 // supported by the codec, it will choose another appropriate value. | 255 // supported by the codec, it will choose another appropriate value. |
277 virtual void SetBitRate(int bitrate_bps) = 0; | 256 virtual void SetBitRate(int bitrate_bps) = 0; |
278 | 257 |
279 /////////////////////////////////////////////////////////////////////////// | |
280 // int32_t SetReceivedEstimatedBandwidth() | |
281 // Set available bandwidth [bits/sec] of the up-link channel. | |
282 // This information is used for traffic shaping, and is currently only | |
283 // supported if iSAC is the send codec. | |
284 // | |
285 // Input: | |
286 // -bw : bandwidth in bits/sec estimated for | |
287 // up-link. | |
288 // Return value | |
289 // -1 if error occurred in setting the bandwidth, | |
290 // 0 bandwidth is set successfully. | |
291 // | |
292 // TODO(henrik.lundin) Unused. Remove? | |
293 virtual int32_t SetReceivedEstimatedBandwidth( | |
294 const int32_t bw) = 0; | |
295 | |
296 /////////////////////////////////////////////////////////////////////////// | |
297 // int32_t RegisterTransportCallback() | 258 // int32_t RegisterTransportCallback() |
298 // Register a transport callback which will be called to deliver | 259 // Register a transport callback which will be called to deliver |
299 // the encoded buffers whenever Process() is called and a | 260 // the encoded buffers whenever Process() is called and a |
300 // bit-stream is ready. | 261 // bit-stream is ready. |
301 // | 262 // |
302 // Input: | 263 // Input: |
303 // -transport : pointer to the callback class | 264 // -transport : pointer to the callback class |
304 // transport->SendData() is called whenever | 265 // transport->SendData() is called whenever |
305 // Process() is called and bit-stream is ready | 266 // Process() is called and bit-stream is ready |
306 // to deliver. | 267 // to deliver. |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 // -vad_mode : is set to the current aggressiveness of VAD. | 420 // -vad_mode : is set to the current aggressiveness of VAD. |
460 // | 421 // |
461 // Return value: | 422 // Return value: |
462 // -1 if fails to retrieve the setting of DTX/VAD, | 423 // -1 if fails to retrieve the setting of DTX/VAD, |
463 // 0 if succeeded. | 424 // 0 if succeeded. |
464 // | 425 // |
465 virtual int32_t VAD(bool* dtx_enabled, bool* vad_enabled, | 426 virtual int32_t VAD(bool* dtx_enabled, bool* vad_enabled, |
466 ACMVADMode* vad_mode) const = 0; | 427 ACMVADMode* vad_mode) const = 0; |
467 | 428 |
468 /////////////////////////////////////////////////////////////////////////// | 429 /////////////////////////////////////////////////////////////////////////// |
469 // int32_t ReplaceInternalDTXWithWebRtc() | |
470 // Used to replace codec internal DTX scheme with WebRtc. | |
471 // | |
472 // Input: | |
473 // -use_webrtc_dtx : if false (default) the codec built-in DTX/VAD | |
474 // scheme is used, otherwise the internal DTX is | |
475 // replaced with WebRtc DTX/VAD. | |
476 // | |
477 // Return value: | |
478 // -1 if failed to replace codec internal DTX with WebRtc, | |
479 // 0 if succeeded. | |
480 // | |
481 virtual int32_t ReplaceInternalDTXWithWebRtc( | |
482 const bool use_webrtc_dtx = false) = 0; | |
483 | |
484 /////////////////////////////////////////////////////////////////////////// | |
485 // int32_t IsInternalDTXReplacedWithWebRtc() | |
486 // Get status if the codec internal DTX is replaced with WebRtc DTX. | |
487 // This should always be true if codec does not have an internal DTX. | |
488 // | |
489 // Output: | |
490 // -uses_webrtc_dtx : is set to true if the codec internal DTX is | |
491 // replaced with WebRtc DTX/VAD, otherwise it is set | |
492 // to false. | |
493 // | |
494 // Return value: | |
495 // -1 if failed to determine if codec internal DTX is replaced with WebRtc, | |
496 // 0 if succeeded. | |
497 // | |
498 virtual int32_t IsInternalDTXReplacedWithWebRtc( | |
499 bool* uses_webrtc_dtx) = 0; | |
500 | |
501 /////////////////////////////////////////////////////////////////////////// | |
502 // int32_t RegisterVADCallback() | 430 // int32_t RegisterVADCallback() |
503 // Call this method to register a callback function which is called | 431 // Call this method to register a callback function which is called |
504 // any time that ACM encounters an empty frame. That is a frame which is | 432 // any time that ACM encounters an empty frame. That is a frame which is |
505 // recognized inactive. Depending on the codec WebRtc VAD or internal codec | 433 // recognized inactive. Depending on the codec WebRtc VAD or internal codec |
506 // VAD is employed to identify a frame as active/inactive. | 434 // VAD is employed to identify a frame as active/inactive. |
507 // | 435 // |
508 // Input: | 436 // Input: |
509 // -vad_callback : pointer to a callback function. | 437 // -vad_callback : pointer to a callback function. |
510 // | 438 // |
511 // Return value: | 439 // Return value: |
(...skipping 15 matching lines...) Expand all Loading... |
527 // For instance, all registered codecs are deleted and have to be | 455 // For instance, all registered codecs are deleted and have to be |
528 // registered again. | 456 // registered again. |
529 // | 457 // |
530 // Return value: | 458 // Return value: |
531 // -1 if failed to initialize, | 459 // -1 if failed to initialize, |
532 // 0 if succeeded. | 460 // 0 if succeeded. |
533 // | 461 // |
534 virtual int32_t InitializeReceiver() = 0; | 462 virtual int32_t InitializeReceiver() = 0; |
535 | 463 |
536 /////////////////////////////////////////////////////////////////////////// | 464 /////////////////////////////////////////////////////////////////////////// |
537 // int32_t ResetDecoder() | |
538 // This API resets the states of decoders. ACM will not lose any | |
539 // decoder-related settings, such as registered codecs. | |
540 // | |
541 // Return value: | |
542 // -1 if failed to initialize, | |
543 // 0 if succeeded. | |
544 // | |
545 virtual int32_t ResetDecoder() = 0; | |
546 | |
547 /////////////////////////////////////////////////////////////////////////// | |
548 // int32_t ReceiveFrequency() | 465 // int32_t ReceiveFrequency() |
549 // Get sampling frequency of the last received payload. | 466 // Get sampling frequency of the last received payload. |
550 // | 467 // |
551 // Return value: | 468 // Return value: |
552 // non-negative the sampling frequency in Hertz. | 469 // non-negative the sampling frequency in Hertz. |
553 // -1 if an error has occurred. | 470 // -1 if an error has occurred. |
554 // | 471 // |
555 virtual int32_t ReceiveFrequency() const = 0; | 472 virtual int32_t ReceiveFrequency() const = 0; |
556 | 473 |
557 /////////////////////////////////////////////////////////////////////////// | 474 /////////////////////////////////////////////////////////////////////////// |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 // -timestamp : a reference to a uint32_t to receive the | 649 // -timestamp : a reference to a uint32_t to receive the |
733 // timestamp. | 650 // timestamp. |
734 // Return value: | 651 // Return value: |
735 // 0 if the output is a correct timestamp. | 652 // 0 if the output is a correct timestamp. |
736 // -1 if failed to output the correct timestamp. | 653 // -1 if failed to output the correct timestamp. |
737 // | 654 // |
738 // TODO(tlegrand): Change function to return the timestamp. | 655 // TODO(tlegrand): Change function to return the timestamp. |
739 virtual int32_t PlayoutTimestamp(uint32_t* timestamp) = 0; | 656 virtual int32_t PlayoutTimestamp(uint32_t* timestamp) = 0; |
740 | 657 |
741 /////////////////////////////////////////////////////////////////////////// | 658 /////////////////////////////////////////////////////////////////////////// |
742 // int32_t DecoderEstimatedBandwidth() | |
743 // Get the estimate of the Bandwidth, in bits/second, based on the incoming | |
744 // stream. This API is useful in one-way communication scenarios, where | |
745 // the bandwidth information is sent in an out-of-band fashion. | |
746 // Currently only supported if iSAC is registered as a receiver. | |
747 // | |
748 // Return value: | |
749 // >0 bandwidth in bits/second. | |
750 // -1 if failed to get a bandwidth estimate. | |
751 // | |
752 virtual int32_t DecoderEstimatedBandwidth() const = 0; | |
753 | |
754 /////////////////////////////////////////////////////////////////////////// | |
755 // int32_t SetPlayoutMode() | 659 // int32_t SetPlayoutMode() |
756 // Call this API to set the playout mode. Playout mode could be optimized | 660 // Call this API to set the playout mode. Playout mode could be optimized |
757 // for i) voice, ii) FAX or iii) streaming. In Voice mode, NetEQ is | 661 // for i) voice, ii) FAX or iii) streaming. In Voice mode, NetEQ is |
758 // optimized to deliver highest audio quality while maintaining a minimum | 662 // optimized to deliver highest audio quality while maintaining a minimum |
759 // delay. In FAX mode, NetEQ is optimized to have few delay changes as | 663 // delay. In FAX mode, NetEQ is optimized to have few delay changes as |
760 // possible and maintain a constant delay, perhaps large relative to voice | 664 // possible and maintain a constant delay, perhaps large relative to voice |
761 // mode, to avoid PLC. In streaming mode, we tolerate a little more delay | 665 // mode, to avoid PLC. In streaming mode, we tolerate a little more delay |
762 // to achieve better jitter robustness. | 666 // to achieve better jitter robustness. |
763 // | 667 // |
764 // Input: | 668 // Input: |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 // Input: | 747 // Input: |
844 // -max_payload_len_bytes : maximum payload size in bytes. | 748 // -max_payload_len_bytes : maximum payload size in bytes. |
845 // | 749 // |
846 // Return value: | 750 // Return value: |
847 // -1 if failed to set the maximum payload-size. | 751 // -1 if failed to set the maximum payload-size. |
848 // 0 if the given length is set successfully. | 752 // 0 if the given length is set successfully. |
849 // | 753 // |
850 virtual int SetISACMaxPayloadSize(int max_payload_len_bytes) = 0; | 754 virtual int SetISACMaxPayloadSize(int max_payload_len_bytes) = 0; |
851 | 755 |
852 /////////////////////////////////////////////////////////////////////////// | 756 /////////////////////////////////////////////////////////////////////////// |
853 // int32_t ConfigISACBandwidthEstimator() | |
854 // Call this function to configure the bandwidth estimator of ISAC. | |
855 // During the adaptation of bit-rate, iSAC automatically adjusts the | |
856 // frame-size (either 30 or 60 ms) to save on RTP header. The initial | |
857 // frame-size can be specified by the first argument. The configuration also | |
858 // regards the initial estimate of bandwidths. The estimator starts from | |
859 // this point and converges to the actual bottleneck. This is given by the | |
860 // second parameter. Furthermore, it is also possible to control the | |
861 // adaptation of frame-size. This is specified by the last parameter. | |
862 // | |
863 // Input: | |
864 // -init_frame_size_ms : initial frame-size in milliseconds. For iSAC-wb | |
865 // 30 ms and 60 ms (default) are acceptable values, | |
866 // and for iSAC-swb 30 ms is the only acceptable | |
867 // value. Zero indicates default value. | |
868 // -init_rate_bps : initial estimate of the bandwidth. Values | |
869 // between 10000 and 58000 are acceptable. | |
870 // -enforce_srame_size : if true, the frame-size will not be adapted. | |
871 // | |
872 // Return value: | |
873 // -1 if failed to configure the bandwidth estimator, | |
874 // 0 if the configuration was successfully applied. | |
875 // | |
876 virtual int32_t ConfigISACBandwidthEstimator( | |
877 int init_frame_size_ms, | |
878 int init_rate_bps, | |
879 bool enforce_frame_size = false) = 0; | |
880 | |
881 /////////////////////////////////////////////////////////////////////////// | |
882 // int SetOpusApplication() | 757 // int SetOpusApplication() |
883 // Sets the intended application if current send codec is Opus. Opus uses this | 758 // Sets the intended application if current send codec is Opus. Opus uses this |
884 // to optimize the encoding for applications like VOIP and music. Currently, | 759 // to optimize the encoding for applications like VOIP and music. Currently, |
885 // two modes are supported: kVoip and kAudio. | 760 // two modes are supported: kVoip and kAudio. |
886 // | 761 // |
887 // Input: | 762 // Input: |
888 // - application : intended application. | 763 // - application : intended application. |
889 // | 764 // |
890 // Return value: | 765 // Return value: |
891 // -1 if current send codec is not Opus or error occurred in setting the | 766 // -1 if current send codec is not Opus or error occurred in setting the |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 virtual std::vector<uint16_t> GetNackList(int round_trip_time_ms) const = 0; | 1042 virtual std::vector<uint16_t> GetNackList(int round_trip_time_ms) const = 0; |
1168 | 1043 |
1169 // Returns the timing statistics for calls to Get10MsAudio. | 1044 // Returns the timing statistics for calls to Get10MsAudio. |
1170 virtual void GetDecodingCallStatistics( | 1045 virtual void GetDecodingCallStatistics( |
1171 AudioDecodingCallStats* call_stats) const = 0; | 1046 AudioDecodingCallStats* call_stats) const = 0; |
1172 }; | 1047 }; |
1173 | 1048 |
1174 } // namespace webrtc | 1049 } // namespace webrtc |
1175 | 1050 |
1176 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_INTERFACE_AUDIO_CODING_MODULE_H_ | 1051 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_INTERFACE_AUDIO_CODING_MODULE_H_ |
OLD | NEW |