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 |
11 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_audio.h" | 11 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_audio.h" |
12 | 12 |
13 #include <assert.h> // assert | 13 #include <assert.h> // assert |
14 #include <math.h> // pow() | 14 #include <math.h> // pow() |
15 #include <string.h> // memcpy() | 15 #include <string.h> // memcpy() |
16 | 16 |
17 #include "webrtc/base/logging.h" | 17 #include "webrtc/base/logging.h" |
18 #include "webrtc/base/trace_event.h" | 18 #include "webrtc/base/trace_event.h" |
19 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 19 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
20 | 20 |
21 namespace webrtc { | 21 namespace webrtc { |
22 RTPReceiverStrategy* RTPReceiverStrategy::CreateAudioStrategy( | 22 RTPReceiverStrategy* RTPReceiverStrategy::CreateAudioStrategy( |
23 RtpData* data_callback) { | 23 RtpData* data_callback, |
24 return new RTPReceiverAudio(data_callback); | 24 RtpAudioFeedback* incoming_messages_callback) { |
| 25 return new RTPReceiverAudio(data_callback, incoming_messages_callback); |
25 } | 26 } |
26 | 27 |
27 RTPReceiverAudio::RTPReceiverAudio(RtpData* data_callback) | 28 RTPReceiverAudio::RTPReceiverAudio(RtpData* data_callback, |
| 29 RtpAudioFeedback* incoming_messages_callback) |
28 : RTPReceiverStrategy(data_callback), | 30 : RTPReceiverStrategy(data_callback), |
29 TelephoneEventHandler(), | 31 TelephoneEventHandler(), |
30 last_received_frequency_(8000), | 32 last_received_frequency_(8000), |
31 telephone_event_forward_to_decoder_(false), | 33 telephone_event_forward_to_decoder_(false), |
32 telephone_event_payload_type_(-1), | 34 telephone_event_payload_type_(-1), |
33 cng_nb_payload_type_(-1), | 35 cng_nb_payload_type_(-1), |
34 cng_wb_payload_type_(-1), | 36 cng_wb_payload_type_(-1), |
35 cng_swb_payload_type_(-1), | 37 cng_swb_payload_type_(-1), |
36 cng_fb_payload_type_(-1), | 38 cng_fb_payload_type_(-1), |
37 cng_payload_type_(-1), | 39 cng_payload_type_(-1), |
38 g722_payload_type_(-1), | 40 g722_payload_type_(-1), |
39 last_received_g722_(false), | 41 last_received_g722_(false), |
40 num_energy_(0), | 42 num_energy_(0), |
41 current_remote_energy_() { | 43 current_remote_energy_(), |
| 44 cb_audio_feedback_(incoming_messages_callback) { |
42 last_payload_.Audio.channels = 1; | 45 last_payload_.Audio.channels = 1; |
43 memset(current_remote_energy_, 0, sizeof(current_remote_energy_)); | 46 memset(current_remote_energy_, 0, sizeof(current_remote_energy_)); |
44 } | 47 } |
45 | 48 |
46 // Outband TelephoneEvent(DTMF) detection | 49 // Outband TelephoneEvent(DTMF) detection |
47 void RTPReceiverAudio::SetTelephoneEventForwardToDecoder( | 50 void RTPReceiverAudio::SetTelephoneEventForwardToDecoder( |
48 bool forward_to_decoder) { | 51 bool forward_to_decoder) { |
49 CriticalSectionScoped lock(crit_sect_.get()); | 52 CriticalSectionScoped lock(crit_sect_.get()); |
50 telephone_event_forward_to_decoder_ = forward_to_decoder; | 53 telephone_event_forward_to_decoder_ = forward_to_decoder; |
51 } | 54 } |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 // only one frame in the RED strip the one byte to help NetEq | 376 // only one frame in the RED strip the one byte to help NetEq |
374 return data_callback_->OnReceivedPayloadData( | 377 return data_callback_->OnReceivedPayloadData( |
375 payload_data + 1, payload_length - 1, rtp_header); | 378 payload_data + 1, payload_length - 1, rtp_header); |
376 } | 379 } |
377 | 380 |
378 rtp_header->type.Audio.channel = audio_specific.channels; | 381 rtp_header->type.Audio.channel = audio_specific.channels; |
379 return data_callback_->OnReceivedPayloadData( | 382 return data_callback_->OnReceivedPayloadData( |
380 payload_data, payload_length, rtp_header); | 383 payload_data, payload_length, rtp_header); |
381 } | 384 } |
382 } // namespace webrtc | 385 } // namespace webrtc |
OLD | NEW |