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