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

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

Issue 1230503003: Update a ton of audio code to use size_t more correctly and in general reduce (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 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) 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_NORMAL_H_ 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECISION_LOGIC_NORMAL_H_
12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECISION_LOGIC_NORMAL_H_ 12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECISION_LOGIC_NORMAL_H_
13 13
14 #include "webrtc/base/constructormagic.h" 14 #include "webrtc/base/constructormagic.h"
15 #include "webrtc/modules/audio_coding/neteq/decision_logic.h" 15 #include "webrtc/modules/audio_coding/neteq/decision_logic.h"
16 #include "webrtc/typedefs.h" 16 #include "webrtc/typedefs.h"
17 17
18 namespace webrtc { 18 namespace webrtc {
19 19
20 // Implementation of the DecisionLogic class for playout modes kPlayoutOn and 20 // Implementation of the DecisionLogic class for playout modes kPlayoutOn and
21 // kPlayoutStreaming. 21 // kPlayoutStreaming.
22 class DecisionLogicNormal : public DecisionLogic { 22 class DecisionLogicNormal : public DecisionLogic {
23 public: 23 public:
24 // Constructor. 24 // Constructor.
25 DecisionLogicNormal(int fs_hz, 25 DecisionLogicNormal(int fs_hz,
26 int output_size_samples, 26 size_t output_size_samples,
27 NetEqPlayoutMode playout_mode, 27 NetEqPlayoutMode playout_mode,
28 DecoderDatabase* decoder_database, 28 DecoderDatabase* decoder_database,
29 const PacketBuffer& packet_buffer, 29 const PacketBuffer& packet_buffer,
30 DelayManager* delay_manager, 30 DelayManager* delay_manager,
31 BufferLevelFilter* buffer_level_filter) 31 BufferLevelFilter* buffer_level_filter)
32 : DecisionLogic(fs_hz, output_size_samples, playout_mode, 32 : DecisionLogic(fs_hz, output_size_samples, playout_mode,
33 decoder_database, packet_buffer, delay_manager, 33 decoder_database, packet_buffer, delay_manager,
34 buffer_level_filter) { 34 buffer_level_filter) {
35 } 35 }
36 36
37 protected: 37 protected:
38 static const int kAllowMergeWithoutExpandMs = 20; // 20 ms. 38 static const int kAllowMergeWithoutExpandMs = 20; // 20 ms.
39 static const int kReinitAfterExpands = 100; 39 static const int kReinitAfterExpands = 100;
40 static const int kMaxWaitForPacket = 10; 40 static const int kMaxWaitForPacket = 10;
41 41
42 // Returns the operation that should be done next. |sync_buffer| and |expand| 42 // Returns the operation that should be done next. |sync_buffer| and |expand|
43 // are provided for reference. |decoder_frame_length| is the number of samples 43 // are provided for reference. |decoder_frame_length| is the number of samples
44 // obtained from the last decoded frame. If there is a packet available, the 44 // obtained from the last decoded frame. If there is a packet available, the
45 // packet header should be supplied in |packet_header|; otherwise it should 45 // packet header should be supplied in |packet_header|; otherwise it should
46 // be NULL. The mode resulting form the last call to NetEqImpl::GetAudio is 46 // be NULL. The mode resulting form the last call to NetEqImpl::GetAudio is
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 int 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) override;
58 58
59 // Returns the operation to do given that the expected packet is not 59 // Returns the operation to do given that the expected packet is not
60 // available, but a packet further into the future is at hand. 60 // available, but a packet further into the future is at hand.
61 virtual Operations FuturePacketAvailable( 61 virtual Operations FuturePacketAvailable(
62 const SyncBuffer& sync_buffer, 62 const SyncBuffer& sync_buffer,
63 const Expand& expand, 63 const Expand& expand,
64 int decoder_frame_length, 64 size_t decoder_frame_length,
65 Modes prev_mode, 65 Modes prev_mode,
66 uint32_t target_timestamp, 66 uint32_t target_timestamp,
67 uint32_t available_timestamp, 67 uint32_t available_timestamp,
68 bool play_dtmf); 68 bool play_dtmf);
69 69
70 // Returns the operation to do given that the expected packet is available. 70 // Returns the operation to do given that the expected packet is available.
71 virtual Operations ExpectedPacketAvailable(Modes prev_mode, bool play_dtmf); 71 virtual Operations ExpectedPacketAvailable(Modes prev_mode, bool play_dtmf);
72 72
73 // Returns the operation given that no packets are available (except maybe 73 // Returns the operation given that no packets are available (except maybe
74 // a DTMF event, flagged by setting |play_dtmf| true). 74 // a DTMF event, flagged by setting |play_dtmf| true).
(...skipping 22 matching lines...) Expand all
97 bool PacketTooEarly(uint32_t timestamp_leap) const; 97 bool PacketTooEarly(uint32_t timestamp_leap) const;
98 98
99 // Checks if num_consecutive_expands_ >= kMaxWaitForPacket. 99 // Checks if num_consecutive_expands_ >= kMaxWaitForPacket.
100 bool MaxWaitForPacket() const; 100 bool MaxWaitForPacket() const;
101 101
102 DISALLOW_COPY_AND_ASSIGN(DecisionLogicNormal); 102 DISALLOW_COPY_AND_ASSIGN(DecisionLogicNormal);
103 }; 103 };
104 104
105 } // namespace webrtc 105 } // namespace webrtc
106 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECISION_LOGIC_NORMAL_H_ 106 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECISION_LOGIC_NORMAL_H_
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/decision_logic_fax.cc ('k') | webrtc/modules/audio_coding/neteq/decision_logic_normal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698