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

Side by Side Diff: webrtc/modules/audio_coding/neteq/decision_logic.h

Issue 2411183003: Removed RTPHeader from NetEq's Packet struct. (Closed)
Patch Set: Fixed naming of payloadType and sequenceNumber. Updated comments. Created 4 years, 2 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) 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
11 #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECISION_LOGIC_H_ 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECISION_LOGIC_H_
12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECISION_LOGIC_H_ 12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECISION_LOGIC_H_
13 13
14 #include "webrtc/base/constructormagic.h" 14 #include "webrtc/base/constructormagic.h"
15 #include "webrtc/modules/audio_coding/neteq/defines.h" 15 #include "webrtc/modules/audio_coding/neteq/defines.h"
16 #include "webrtc/modules/audio_coding/neteq/include/neteq.h" 16 #include "webrtc/modules/audio_coding/neteq/include/neteq.h"
17 #include "webrtc/modules/audio_coding/neteq/tick_timer.h" 17 #include "webrtc/modules/audio_coding/neteq/tick_timer.h"
18 #include "webrtc/typedefs.h" 18 #include "webrtc/typedefs.h"
19 19
20 namespace webrtc { 20 namespace webrtc {
21 21
22 // Forward declarations. 22 // Forward declarations.
23 class BufferLevelFilter; 23 class BufferLevelFilter;
24 class DecoderDatabase; 24 class DecoderDatabase;
25 class DelayManager; 25 class DelayManager;
26 class Expand; 26 class Expand;
27 class PacketBuffer; 27 class PacketBuffer;
28 class SyncBuffer; 28 class SyncBuffer;
29 struct RTPHeader; 29 struct Packet;
30 30
31 // This is the base class for the decision tree implementations. Derived classes 31 // This is the base class for the decision tree implementations. Derived classes
32 // must implement the method GetDecisionSpecialized(). 32 // must implement the method GetDecisionSpecialized().
33 class DecisionLogic { 33 class DecisionLogic {
34 public: 34 public:
35 // Static factory function which creates different types of objects depending 35 // Static factory function which creates different types of objects depending
36 // on the |playout_mode|. 36 // on the |playout_mode|.
37 static DecisionLogic* Create(int fs_hz, 37 static DecisionLogic* Create(int fs_hz,
38 size_t output_size_samples, 38 size_t output_size_samples,
39 NetEqPlayoutMode playout_mode, 39 NetEqPlayoutMode playout_mode,
(...skipping 19 matching lines...) Expand all
59 void Reset(); 59 void Reset();
60 60
61 // Resets parts of the state. Typically done when switching codecs. 61 // Resets parts of the state. Typically done when switching codecs.
62 void SoftReset(); 62 void SoftReset();
63 63
64 // Sets the sample rate and the output block size. 64 // Sets the sample rate and the output block size.
65 void SetSampleRate(int fs_hz, size_t output_size_samples); 65 void SetSampleRate(int fs_hz, size_t output_size_samples);
66 66
67 // Returns the operation that should be done next. |sync_buffer| and |expand| 67 // Returns the operation that should be done next. |sync_buffer| and |expand|
68 // are provided for reference. |decoder_frame_length| is the number of samples 68 // are provided for reference. |decoder_frame_length| is the number of samples
69 // obtained from the last decoded frame. If there is a packet available, the 69 // obtained from the last decoded frame. If there is a packet available, it
70 // packet header should be supplied in |packet_header|; otherwise it should 70 // should be supplied in |next_packet|; otherwise it should be NULL. The mode
71 // be NULL. The mode resulting form the last call to NetEqImpl::GetAudio is 71 // resulting from the last call to NetEqImpl::GetAudio is supplied in
72 // supplied in |prev_mode|. If there is a DTMF event to play, |play_dtmf| 72 // |prev_mode|. If there is a DTMF event to play, |play_dtmf| should be set to
73 // should be set to true. The output variable |reset_decoder| will be set to 73 // true. The output variable |reset_decoder| will be set to true if a reset is
74 // true if a reset is required; otherwise it is left unchanged (i.e., it can 74 // required; otherwise it is left unchanged (i.e., it can remain true if it
75 // remain true if it was true before the call). 75 // was true before the call). This method end with calling
76 // This method end with calling GetDecisionSpecialized to get the actual 76 // GetDecisionSpecialized to get the actual return value.
77 // return value.
78 Operations GetDecision(const SyncBuffer& sync_buffer, 77 Operations GetDecision(const SyncBuffer& sync_buffer,
79 const Expand& expand, 78 const Expand& expand,
80 size_t decoder_frame_length, 79 size_t decoder_frame_length,
81 const RTPHeader* packet_header, 80 const Packet* next_packet,
82 Modes prev_mode, 81 Modes prev_mode,
83 bool play_dtmf, 82 bool play_dtmf,
84 size_t generated_noise_samples, 83 size_t generated_noise_samples,
85 bool* reset_decoder); 84 bool* reset_decoder);
86 85
87 // These methods test the |cng_state_| for different conditions. 86 // These methods test the |cng_state_| for different conditions.
88 bool CngRfc3389On() const { return cng_state_ == kCngRfc3389On; } 87 bool CngRfc3389On() const { return cng_state_ == kCngRfc3389On; }
89 bool CngOff() const { return cng_state_ == kCngOff; } 88 bool CngOff() const { return cng_state_ == kCngOff; }
90 89
91 // Resets the |cng_state_| to kCngOff. 90 // Resets the |cng_state_| to kCngOff.
(...skipping 25 matching lines...) Expand all
117 static const int kMinTimescaleInterval = 5; 116 static const int kMinTimescaleInterval = 5;
118 117
119 enum CngState { 118 enum CngState {
120 kCngOff, 119 kCngOff,
121 kCngRfc3389On, 120 kCngRfc3389On,
122 kCngInternalOn 121 kCngInternalOn
123 }; 122 };
124 123
125 // Returns the operation that should be done next. |sync_buffer| and |expand| 124 // Returns the operation that should be done next. |sync_buffer| and |expand|
126 // are provided for reference. |decoder_frame_length| is the number of samples 125 // are provided for reference. |decoder_frame_length| is the number of samples
127 // obtained from the last decoded frame. If there is a packet available, the 126 // obtained from the last decoded frame. If there is a packet available, it
128 // packet header should be supplied in |packet_header|; otherwise it should 127 // should be supplied in |next_packet|; otherwise it should be NULL. The mode
129 // be NULL. The mode resulting form the last call to NetEqImpl::GetAudio is 128 // resulting from the last call to NetEqImpl::GetAudio is supplied in
130 // supplied in |prev_mode|. If there is a DTMF event to play, |play_dtmf| 129 // |prev_mode|. If there is a DTMF event to play, |play_dtmf| should be set to
131 // should be set to true. The output variable |reset_decoder| will be set to 130 // true. The output variable |reset_decoder| will be set to true if a reset is
132 // true if a reset is required; otherwise it is left unchanged (i.e., it can 131 // required; otherwise it is left unchanged (i.e., it can remain true if it
133 // remain true if it was true before the call). 132 // was true before the call). Should be implemented by derived classes.
134 // Should be implemented by derived classes.
135 virtual Operations GetDecisionSpecialized(const SyncBuffer& sync_buffer, 133 virtual Operations GetDecisionSpecialized(const SyncBuffer& sync_buffer,
136 const Expand& expand, 134 const Expand& expand,
137 size_t decoder_frame_length, 135 size_t decoder_frame_length,
138 const RTPHeader* packet_header, 136 const Packet* next_packet,
139 Modes prev_mode, 137 Modes prev_mode,
140 bool play_dtmf, 138 bool play_dtmf,
141 bool* reset_decoder, 139 bool* reset_decoder,
142 size_t generated_noise_samples) = 0; 140 size_t generated_noise_samples) = 0;
143 141
144 // Updates the |buffer_level_filter_| with the current buffer level 142 // Updates the |buffer_level_filter_| with the current buffer level
145 // |buffer_size_packets|. 143 // |buffer_size_packets|.
146 void FilterBufferLevel(size_t buffer_size_packets, Modes prev_mode); 144 void FilterBufferLevel(size_t buffer_size_packets, Modes prev_mode);
147 145
148 DecoderDatabase* decoder_database_; 146 DecoderDatabase* decoder_database_;
(...skipping 12 matching lines...) Expand all
161 std::unique_ptr<TickTimer::Countdown> timescale_countdown_; 159 std::unique_ptr<TickTimer::Countdown> timescale_countdown_;
162 int num_consecutive_expands_; 160 int num_consecutive_expands_;
163 const NetEqPlayoutMode playout_mode_; 161 const NetEqPlayoutMode playout_mode_;
164 162
165 private: 163 private:
166 RTC_DISALLOW_COPY_AND_ASSIGN(DecisionLogic); 164 RTC_DISALLOW_COPY_AND_ASSIGN(DecisionLogic);
167 }; 165 };
168 166
169 } // namespace webrtc 167 } // namespace webrtc
170 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECISION_LOGIC_H_ 168 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECISION_LOGIC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698