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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 ~NetEqImpl() override; | 101 ~NetEqImpl() override; |
102 | 102 |
103 // Inserts a new packet into NetEq. The |receive_timestamp| is an indication | 103 // Inserts a new packet into NetEq. The |receive_timestamp| is an indication |
104 // of the time when the packet was received, and should be measured with | 104 // of the time when the packet was received, and should be measured with |
105 // the same tick rate as the RTP timestamp of the current payload. | 105 // the same tick rate as the RTP timestamp of the current payload. |
106 // Returns 0 on success, -1 on failure. | 106 // Returns 0 on success, -1 on failure. |
107 int InsertPacket(const WebRtcRTPHeader& rtp_header, | 107 int InsertPacket(const WebRtcRTPHeader& rtp_header, |
108 rtc::ArrayView<const uint8_t> payload, | 108 rtc::ArrayView<const uint8_t> payload, |
109 uint32_t receive_timestamp) override; | 109 uint32_t receive_timestamp) override; |
110 | 110 |
111 // Inserts a sync-packet into packet queue. Sync-packets are decoded to | |
112 // silence and are intended to keep AV-sync intact in an event of long packet | |
113 // losses when Video NACK is enabled but Audio NACK is not. Clients of NetEq | |
114 // might insert sync-packet when they observe that buffer level of NetEq is | |
115 // decreasing below a certain threshold, defined by the application. | |
116 // Sync-packets should have the same payload type as the last audio payload | |
117 // type, i.e. they cannot have DTMF or CNG payload type, nor a codec change | |
118 // can be implied by inserting a sync-packet. | |
119 // Returns kOk on success, kFail on failure. | |
120 int InsertSyncPacket(const WebRtcRTPHeader& rtp_header, | |
121 uint32_t receive_timestamp) override; | |
122 | |
123 int GetAudio(AudioFrame* audio_frame, bool* muted) override; | 111 int GetAudio(AudioFrame* audio_frame, bool* muted) override; |
124 | 112 |
125 int RegisterPayloadType(NetEqDecoder codec, | 113 int RegisterPayloadType(NetEqDecoder codec, |
126 const std::string& codec_name, | 114 const std::string& codec_name, |
127 uint8_t rtp_payload_type) override; | 115 uint8_t rtp_payload_type) override; |
128 | 116 |
129 int RegisterExternalDecoder(AudioDecoder* decoder, | 117 int RegisterExternalDecoder(AudioDecoder* decoder, |
130 NetEqDecoder codec, | 118 NetEqDecoder codec, |
131 const std::string& codec_name, | 119 const std::string& codec_name, |
132 uint8_t rtp_payload_type) override; | 120 uint8_t rtp_payload_type) override; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 // TODO(hlundin): Provide a better value for kSyncBufferSize. | 204 // TODO(hlundin): Provide a better value for kSyncBufferSize. |
217 // Current value is kMaxFrameSize + 60 ms * 48 kHz, which is enough for | 205 // Current value is kMaxFrameSize + 60 ms * 48 kHz, which is enough for |
218 // calculating correlations of current frame against history. | 206 // calculating correlations of current frame against history. |
219 static const size_t kSyncBufferSize = kMaxFrameSize + 60 * 48; | 207 static const size_t kSyncBufferSize = kMaxFrameSize + 60 * 48; |
220 | 208 |
221 // Inserts a new packet into NetEq. This is used by the InsertPacket method | 209 // Inserts a new packet into NetEq. This is used by the InsertPacket method |
222 // above. Returns 0 on success, otherwise an error code. | 210 // above. Returns 0 on success, otherwise an error code. |
223 // TODO(hlundin): Merge this with InsertPacket above? | 211 // TODO(hlundin): Merge this with InsertPacket above? |
224 int InsertPacketInternal(const WebRtcRTPHeader& rtp_header, | 212 int InsertPacketInternal(const WebRtcRTPHeader& rtp_header, |
225 rtc::ArrayView<const uint8_t> payload, | 213 rtc::ArrayView<const uint8_t> payload, |
226 uint32_t receive_timestamp, | 214 uint32_t receive_timestamp) |
227 bool is_sync_packet) | |
228 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | 215 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
229 | 216 |
230 // Delivers 10 ms of audio data. The data is written to |audio_frame|. | 217 // Delivers 10 ms of audio data. The data is written to |audio_frame|. |
231 // Returns 0 on success, otherwise an error code. | 218 // Returns 0 on success, otherwise an error code. |
232 int GetAudioInternal(AudioFrame* audio_frame, bool* muted) | 219 int GetAudioInternal(AudioFrame* audio_frame, bool* muted) |
233 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | 220 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
234 | 221 |
235 // Provides a decision to the GetAudioInternal method. The decision what to | 222 // Provides a decision to the GetAudioInternal method. The decision what to |
236 // do is written to |operation|. Packets to decode are written to | 223 // do is written to |operation|. Packets to decode are written to |
237 // |packet_list|, and a DTMF event to play is written to |dtmf_event|. When | 224 // |packet_list|, and a DTMF event to play is written to |dtmf_event|. When |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 AudioFrame::kVadPassive; | 401 AudioFrame::kVadPassive; |
415 std::unique_ptr<TickTimer::Stopwatch> generated_noise_stopwatch_ | 402 std::unique_ptr<TickTimer::Stopwatch> generated_noise_stopwatch_ |
416 GUARDED_BY(crit_sect_); | 403 GUARDED_BY(crit_sect_); |
417 | 404 |
418 private: | 405 private: |
419 RTC_DISALLOW_COPY_AND_ASSIGN(NetEqImpl); | 406 RTC_DISALLOW_COPY_AND_ASSIGN(NetEqImpl); |
420 }; | 407 }; |
421 | 408 |
422 } // namespace webrtc | 409 } // namespace webrtc |
423 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_NETEQ_IMPL_H_ | 410 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_NETEQ_IMPL_H_ |
OLD | NEW |