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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 int LastError() override; | 50 int LastError() override; |
51 | 51 |
52 AudioTransport* audio_transport() override { return this; } | 52 AudioTransport* audio_transport() override { return this; } |
53 | 53 |
54 int AssociateSendChannel(int channel, int accociate_send_channel) override; | 54 int AssociateSendChannel(int channel, int accociate_send_channel) override; |
55 | 55 |
56 // AudioTransport | 56 // AudioTransport |
57 int32_t RecordedDataIsAvailable(const void* audioSamples, | 57 int32_t RecordedDataIsAvailable(const void* audioSamples, |
58 const size_t nSamples, | 58 const size_t nSamples, |
59 const size_t nBytesPerSample, | 59 const size_t nBytesPerSample, |
60 const uint8_t nChannels, | 60 const size_t nChannels, |
61 const uint32_t samplesPerSec, | 61 const uint32_t samplesPerSec, |
62 const uint32_t totalDelayMS, | 62 const uint32_t totalDelayMS, |
63 const int32_t clockDrift, | 63 const int32_t clockDrift, |
64 const uint32_t currentMicLevel, | 64 const uint32_t currentMicLevel, |
65 const bool keyPressed, | 65 const bool keyPressed, |
66 uint32_t& newMicLevel) override; | 66 uint32_t& newMicLevel) override; |
67 int32_t NeedMorePlayData(const size_t nSamples, | 67 int32_t NeedMorePlayData(const size_t nSamples, |
68 const size_t nBytesPerSample, | 68 const size_t nBytesPerSample, |
69 const uint8_t nChannels, | 69 const size_t nChannels, |
70 const uint32_t samplesPerSec, | 70 const uint32_t samplesPerSec, |
71 void* audioSamples, | 71 void* audioSamples, |
72 size_t& nSamplesOut, | 72 size_t& nSamplesOut, |
73 int64_t* elapsed_time_ms, | 73 int64_t* elapsed_time_ms, |
74 int64_t* ntp_time_ms) override; | 74 int64_t* ntp_time_ms) override; |
75 int OnDataAvailable(const int voe_channels[], | 75 int OnDataAvailable(const int voe_channels[], |
76 int number_of_voe_channels, | 76 size_t number_of_voe_channels, |
77 const int16_t* audio_data, | 77 const int16_t* audio_data, |
78 int sample_rate, | 78 int sample_rate, |
79 int number_of_channels, | 79 size_t number_of_channels, |
80 size_t number_of_frames, | 80 size_t number_of_frames, |
81 int audio_delay_milliseconds, | 81 int audio_delay_milliseconds, |
82 int current_volume, | 82 int current_volume, |
83 bool key_pressed, | 83 bool key_pressed, |
84 bool need_audio_processing) override; | 84 bool need_audio_processing) override; |
85 void OnData(int voe_channel, | 85 void OnData(int voe_channel, |
86 const void* audio_data, | 86 const void* audio_data, |
87 int bits_per_sample, | 87 int bits_per_sample, |
88 int sample_rate, | 88 int sample_rate, |
89 int number_of_channels, | 89 size_t number_of_channels, |
90 size_t number_of_frames) override; | 90 size_t number_of_frames) override; |
91 void PushCaptureData(int voe_channel, | 91 void PushCaptureData(int voe_channel, |
92 const void* audio_data, | 92 const void* audio_data, |
93 int bits_per_sample, | 93 int bits_per_sample, |
94 int sample_rate, | 94 int sample_rate, |
95 int number_of_channels, | 95 size_t number_of_channels, |
96 size_t number_of_frames) override; | 96 size_t number_of_frames) override; |
97 void PullRenderData(int bits_per_sample, | 97 void PullRenderData(int bits_per_sample, |
98 int sample_rate, | 98 int sample_rate, |
99 int number_of_channels, | 99 size_t number_of_channels, |
100 size_t number_of_frames, | 100 size_t number_of_frames, |
101 void* audio_data, | 101 void* audio_data, |
102 int64_t* elapsed_time_ms, | 102 int64_t* elapsed_time_ms, |
103 int64_t* ntp_time_ms) override; | 103 int64_t* ntp_time_ms) override; |
104 | 104 |
105 // AudioDeviceObserver | 105 // AudioDeviceObserver |
106 void OnErrorIsReported(const ErrorCode error) override; | 106 void OnErrorIsReported(const ErrorCode error) override; |
107 void OnWarningIsReported(const WarningCode warning) override; | 107 void OnWarningIsReported(const WarningCode warning) override; |
108 | 108 |
109 protected: | 109 protected: |
110 VoEBaseImpl(voe::SharedData* shared); | 110 VoEBaseImpl(voe::SharedData* shared); |
111 ~VoEBaseImpl() override; | 111 ~VoEBaseImpl() override; |
112 | 112 |
113 private: | 113 private: |
114 int32_t StartPlayout(); | 114 int32_t StartPlayout(); |
115 int32_t StopPlayout(); | 115 int32_t StopPlayout(); |
116 int32_t StartSend(); | 116 int32_t StartSend(); |
117 int32_t StopSend(); | 117 int32_t StopSend(); |
118 int32_t TerminateInternal(); | 118 int32_t TerminateInternal(); |
119 | 119 |
120 // Helper function to process the recorded data with AudioProcessing Module, | 120 // Helper function to process the recorded data with AudioProcessing Module, |
121 // demultiplex the data to specific voe channels, encode and send to the | 121 // demultiplex the data to specific voe channels, encode and send to the |
122 // network. When |number_of_VoE_channels| is 0, it will demultiplex the | 122 // network. When |number_of_VoE_channels| is 0, it will demultiplex the |
123 // data to all the existing VoE channels. | 123 // data to all the existing VoE channels. |
124 // It returns new AGC microphone volume or 0 if no volume changes | 124 // It returns new AGC microphone volume or 0 if no volume changes |
125 // should be done. | 125 // should be done. |
126 int ProcessRecordedDataWithAPM( | 126 int ProcessRecordedDataWithAPM( |
127 const int voe_channels[], int number_of_voe_channels, | 127 const int voe_channels[], size_t number_of_voe_channels, |
128 const void* audio_data, uint32_t sample_rate, uint8_t number_of_channels, | 128 const void* audio_data, uint32_t sample_rate, size_t number_of_channels, |
129 size_t number_of_frames, uint32_t audio_delay_milliseconds, | 129 size_t number_of_frames, uint32_t audio_delay_milliseconds, |
130 int32_t clock_drift, uint32_t volume, bool key_pressed); | 130 int32_t clock_drift, uint32_t volume, bool key_pressed); |
131 | 131 |
132 void GetPlayoutData(int sample_rate, int number_of_channels, | 132 void GetPlayoutData(int sample_rate, size_t number_of_channels, |
133 size_t number_of_frames, bool feed_data_to_apm, | 133 size_t number_of_frames, bool feed_data_to_apm, |
134 void* audio_data, int64_t* elapsed_time_ms, | 134 void* audio_data, int64_t* elapsed_time_ms, |
135 int64_t* ntp_time_ms); | 135 int64_t* ntp_time_ms); |
136 | 136 |
137 // Initialize channel by setting Engine Information then initializing | 137 // Initialize channel by setting Engine Information then initializing |
138 // channel. | 138 // channel. |
139 int InitializeChannel(voe::ChannelOwner* channel_owner); | 139 int InitializeChannel(voe::ChannelOwner* channel_owner); |
140 VoiceEngineObserver* voiceEngineObserverPtr_; | 140 VoiceEngineObserver* voiceEngineObserverPtr_; |
141 CriticalSectionWrapper& callbackCritSect_; | 141 CriticalSectionWrapper& callbackCritSect_; |
142 | 142 |
143 AudioFrame audioFrame_; | 143 AudioFrame audioFrame_; |
144 voe::SharedData* shared_; | 144 voe::SharedData* shared_; |
145 }; | 145 }; |
146 | 146 |
147 } // namespace webrtc | 147 } // namespace webrtc |
148 | 148 |
149 #endif // WEBRTC_VOICE_ENGINE_VOE_BASE_IMPL_H | 149 #endif // WEBRTC_VOICE_ENGINE_VOE_BASE_IMPL_H |
OLD | NEW |