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_sender_audio.h" | 11 #include "webrtc/modules/rtp_rtcp/source/rtp_sender_audio.h" |
12 | 12 |
13 #include <assert.h> //assert | 13 #include <assert.h> //assert |
14 #include <string.h> //memcpy | 14 #include <string.h> //memcpy |
15 | 15 |
| 16 #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h" |
16 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 17 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
17 #include "webrtc/system_wrappers/interface/trace_event.h" | 18 #include "webrtc/system_wrappers/interface/trace_event.h" |
18 | 19 |
19 namespace webrtc { | 20 namespace webrtc { |
20 | 21 |
21 static const int kDtmfFrequencyHz = 8000; | 22 static const int kDtmfFrequencyHz = 8000; |
22 | 23 |
23 RTPSenderAudio::RTPSenderAudio(Clock* clock, | 24 RTPSenderAudio::RTPSenderAudio(Clock* clock, |
24 RTPSender* rtpSender, | 25 RTPSender* rtpSender, |
25 RtpAudioFeedback* audio_feedback) | 26 RtpAudioFeedback* audio_feedback) |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 RTPHeader rtp_header; | 362 RTPHeader rtp_header; |
362 rtp_parser.Parse(rtp_header); | 363 rtp_parser.Parse(rtp_header); |
363 _rtpSender->UpdateAudioLevel(dataBuffer, packetSize, rtp_header, | 364 _rtpSender->UpdateAudioLevel(dataBuffer, packetSize, rtp_header, |
364 (frameType == kAudioFrameSpeech), | 365 (frameType == kAudioFrameSpeech), |
365 audio_level_dbov); | 366 audio_level_dbov); |
366 TRACE_EVENT_ASYNC_END2("webrtc", "Audio", captureTimeStamp, "timestamp", | 367 TRACE_EVENT_ASYNC_END2("webrtc", "Audio", captureTimeStamp, "timestamp", |
367 _rtpSender->Timestamp(), "seqnum", | 368 _rtpSender->Timestamp(), "seqnum", |
368 _rtpSender->SequenceNumber()); | 369 _rtpSender->SequenceNumber()); |
369 return _rtpSender->SendToNetwork(dataBuffer, payloadSize, rtpHeaderLength, | 370 return _rtpSender->SendToNetwork(dataBuffer, payloadSize, rtpHeaderLength, |
370 -1, kAllowRetransmission, | 371 -1, kAllowRetransmission, |
371 PacedSender::kHighPriority); | 372 RtpPacketSender::kHighPriority); |
372 } | 373 } |
373 | 374 |
374 // Audio level magnitude and voice activity flag are set for each RTP packet | 375 // Audio level magnitude and voice activity flag are set for each RTP packet |
375 int32_t | 376 int32_t |
376 RTPSenderAudio::SetAudioLevel(const uint8_t level_dBov) | 377 RTPSenderAudio::SetAudioLevel(const uint8_t level_dBov) |
377 { | 378 { |
378 if (level_dBov > 127) | 379 if (level_dBov > 127) |
379 { | 380 { |
380 return -1; | 381 return -1; |
381 } | 382 } |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 dtmfbuffer[12] = _dtmfKey; | 471 dtmfbuffer[12] = _dtmfKey; |
471 dtmfbuffer[13] = E|R|volume; | 472 dtmfbuffer[13] = E|R|volume; |
472 ByteWriter<uint16_t>::WriteBigEndian(dtmfbuffer + 14, duration); | 473 ByteWriter<uint16_t>::WriteBigEndian(dtmfbuffer + 14, duration); |
473 | 474 |
474 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), | 475 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), |
475 "Audio::SendTelephoneEvent", "timestamp", | 476 "Audio::SendTelephoneEvent", "timestamp", |
476 dtmfTimeStamp, "seqnum", | 477 dtmfTimeStamp, "seqnum", |
477 _rtpSender->SequenceNumber()); | 478 _rtpSender->SequenceNumber()); |
478 retVal = _rtpSender->SendToNetwork(dtmfbuffer, 4, 12, -1, | 479 retVal = _rtpSender->SendToNetwork(dtmfbuffer, 4, 12, -1, |
479 kAllowRetransmission, | 480 kAllowRetransmission, |
480 PacedSender::kHighPriority); | 481 RtpPacketSender::kHighPriority); |
481 sendCount--; | 482 sendCount--; |
482 | 483 |
483 }while (sendCount > 0 && retVal == 0); | 484 }while (sendCount > 0 && retVal == 0); |
484 | 485 |
485 return retVal; | 486 return retVal; |
486 } | 487 } |
487 } // namespace webrtc | 488 } // namespace webrtc |
OLD | NEW |