| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // supplied in |prev_mode|. If there is a DTMF event to play, |play_dtmf| | 47 // supplied in |prev_mode|. If there is a DTMF event to play, |play_dtmf| |
| 48 // should be set to true. The output variable |reset_decoder| will be set to | 48 // should be set to true. The output variable |reset_decoder| will be set to |
| 49 // true if a reset is required; otherwise it is left unchanged (i.e., it can | 49 // true if a reset is required; otherwise it is left unchanged (i.e., it can |
| 50 // remain true if it was true before the call). | 50 // remain true if it was true before the call). |
| 51 Operations GetDecisionSpecialized(const SyncBuffer& sync_buffer, | 51 Operations GetDecisionSpecialized(const SyncBuffer& sync_buffer, |
| 52 const Expand& expand, | 52 const Expand& expand, |
| 53 size_t decoder_frame_length, | 53 size_t decoder_frame_length, |
| 54 const RTPHeader* packet_header, | 54 const RTPHeader* packet_header, |
| 55 Modes prev_mode, | 55 Modes prev_mode, |
| 56 bool play_dtmf, | 56 bool play_dtmf, |
| 57 bool* reset_decoder) override; | 57 bool* reset_decoder, |
| 58 size_t generated_noise_samples) override; |
| 58 | 59 |
| 59 // Returns the operation to do given that the expected packet is not | 60 // Returns the operation to do given that the expected packet is not |
| 60 // available, but a packet further into the future is at hand. | 61 // available, but a packet further into the future is at hand. |
| 61 virtual Operations FuturePacketAvailable( | 62 virtual Operations FuturePacketAvailable( |
| 62 const SyncBuffer& sync_buffer, | 63 const SyncBuffer& sync_buffer, |
| 63 const Expand& expand, | 64 const Expand& expand, |
| 64 size_t decoder_frame_length, | 65 size_t decoder_frame_length, |
| 65 Modes prev_mode, | 66 Modes prev_mode, |
| 66 uint32_t target_timestamp, | 67 uint32_t target_timestamp, |
| 67 uint32_t available_timestamp, | 68 uint32_t available_timestamp, |
| 68 bool play_dtmf); | 69 bool play_dtmf, |
| 70 size_t generated_noise_samples); |
| 69 | 71 |
| 70 // Returns the operation to do given that the expected packet is available. | 72 // Returns the operation to do given that the expected packet is available. |
| 71 virtual Operations ExpectedPacketAvailable(Modes prev_mode, bool play_dtmf); | 73 virtual Operations ExpectedPacketAvailable(Modes prev_mode, bool play_dtmf); |
| 72 | 74 |
| 73 // Returns the operation given that no packets are available (except maybe | 75 // Returns the operation given that no packets are available (except maybe |
| 74 // a DTMF event, flagged by setting |play_dtmf| true). | 76 // a DTMF event, flagged by setting |play_dtmf| true). |
| 75 virtual Operations NoPacket(bool play_dtmf); | 77 virtual Operations NoPacket(bool play_dtmf); |
| 76 | 78 |
| 77 private: | 79 private: |
| 78 // Returns the operation given that the next available packet is a comfort | 80 // Returns the operation given that the next available packet is a comfort |
| 79 // noise payload (RFC 3389 only, not codec-internal). | 81 // noise payload (RFC 3389 only, not codec-internal). |
| 80 Operations CngOperation(Modes prev_mode, uint32_t target_timestamp, | 82 Operations CngOperation(Modes prev_mode, |
| 81 uint32_t available_timestamp); | 83 uint32_t target_timestamp, |
| 84 uint32_t available_timestamp, |
| 85 size_t generated_noise_samples); |
| 82 | 86 |
| 83 // Checks if enough time has elapsed since the last successful timescale | 87 // Checks if enough time has elapsed since the last successful timescale |
| 84 // operation was done (i.e., accelerate or preemptive expand). | 88 // operation was done (i.e., accelerate or preemptive expand). |
| 85 bool TimescaleAllowed() const { return timescale_hold_off_ == 0; } | 89 bool TimescaleAllowed() const { return timescale_hold_off_ == 0; } |
| 86 | 90 |
| 87 // Checks if the current (filtered) buffer level is under the target level. | 91 // Checks if the current (filtered) buffer level is under the target level. |
| 88 bool UnderTargetLevel() const; | 92 bool UnderTargetLevel() const; |
| 89 | 93 |
| 90 // Checks if |timestamp_leap| is so long into the future that a reset due | 94 // Checks if |timestamp_leap| is so long into the future that a reset due |
| 91 // to exceeding kReinitAfterExpands will be done. | 95 // to exceeding kReinitAfterExpands will be done. |
| 92 bool ReinitAfterExpands(uint32_t timestamp_leap) const; | 96 bool ReinitAfterExpands(uint32_t timestamp_leap) const; |
| 93 | 97 |
| 94 // Checks if we still have not done enough expands to cover the distance from | 98 // Checks if we still have not done enough expands to cover the distance from |
| 95 // the last decoded packet to the next available packet, the distance beeing | 99 // the last decoded packet to the next available packet, the distance beeing |
| 96 // conveyed in |timestamp_leap|. | 100 // conveyed in |timestamp_leap|. |
| 97 bool PacketTooEarly(uint32_t timestamp_leap) const; | 101 bool PacketTooEarly(uint32_t timestamp_leap) const; |
| 98 | 102 |
| 99 // Checks if num_consecutive_expands_ >= kMaxWaitForPacket. | 103 // Checks if num_consecutive_expands_ >= kMaxWaitForPacket. |
| 100 bool MaxWaitForPacket() const; | 104 bool MaxWaitForPacket() const; |
| 101 | 105 |
| 102 RTC_DISALLOW_COPY_AND_ASSIGN(DecisionLogicNormal); | 106 RTC_DISALLOW_COPY_AND_ASSIGN(DecisionLogicNormal); |
| 103 }; | 107 }; |
| 104 | 108 |
| 105 } // namespace webrtc | 109 } // namespace webrtc |
| 106 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECISION_LOGIC_NORMAL_H_ | 110 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECISION_LOGIC_NORMAL_H_ |
| OLD | NEW |