Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(988)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_sender_audio.cc

Issue 1335353005: Remove channel ids from various interfaces. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/source/byte_io.h" 16 #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
17 #include "webrtc/system_wrappers/interface/trace_event.h" 17 #include "webrtc/system_wrappers/interface/trace_event.h"
18 18
19 namespace webrtc { 19 namespace webrtc {
20 20
21 static const int kDtmfFrequencyHz = 8000; 21 static const int kDtmfFrequencyHz = 8000;
22 22
23 RTPSenderAudio::RTPSenderAudio(const int32_t id, 23 RTPSenderAudio::RTPSenderAudio(Clock* clock,
24 Clock* clock,
25 RTPSender* rtpSender, 24 RTPSender* rtpSender,
26 RtpAudioFeedback* audio_feedback) : 25 RtpAudioFeedback* audio_feedback)
27 _id(id), 26 : _clock(clock),
28 _clock(clock), 27 _rtpSender(rtpSender),
29 _rtpSender(rtpSender), 28 _audioFeedback(audio_feedback),
30 _audioFeedback(audio_feedback), 29 _sendAudioCritsect(CriticalSectionWrapper::CreateCriticalSection()),
31 _sendAudioCritsect(CriticalSectionWrapper::CreateCriticalSection()), 30 _packetSizeSamples(160),
32 _packetSizeSamples(160), 31 _dtmfEventIsOn(false),
33 _dtmfEventIsOn(false), 32 _dtmfEventFirstPacketSent(false),
34 _dtmfEventFirstPacketSent(false), 33 _dtmfPayloadType(-1),
35 _dtmfPayloadType(-1), 34 _dtmfTimestamp(0),
36 _dtmfTimestamp(0), 35 _dtmfKey(0),
37 _dtmfKey(0), 36 _dtmfLengthSamples(0),
38 _dtmfLengthSamples(0), 37 _dtmfLevel(0),
39 _dtmfLevel(0), 38 _dtmfTimeLastSent(0),
40 _dtmfTimeLastSent(0), 39 _dtmfTimestampLastSent(0),
41 _dtmfTimestampLastSent(0), 40 _REDPayloadType(-1),
42 _REDPayloadType(-1), 41 _inbandVADactive(false),
43 _inbandVADactive(false), 42 _cngNBPayloadType(-1),
44 _cngNBPayloadType(-1), 43 _cngWBPayloadType(-1),
45 _cngWBPayloadType(-1), 44 _cngSWBPayloadType(-1),
46 _cngSWBPayloadType(-1), 45 _cngFBPayloadType(-1),
47 _cngFBPayloadType(-1), 46 _lastPayloadType(-1),
48 _lastPayloadType(-1), 47 _audioLevel_dBov(0) {}
49 _audioLevel_dBov(0) {
50 }
51 48
52 RTPSenderAudio::~RTPSenderAudio() { 49 RTPSenderAudio::~RTPSenderAudio() {
53 } 50 }
54 51
55 int RTPSenderAudio::AudioFrequency() const { 52 int RTPSenderAudio::AudioFrequency() const {
56 return kDtmfFrequencyHz; 53 return kDtmfFrequencyHz;
57 } 54 }
58 55
59 // set audio packet size, used to determine when it's time to send a DTMF packet 56 // set audio packet size, used to determine when it's time to send a DTMF packet
60 // in silence (CNG) 57 // in silence (CNG)
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 _dtmfEventFirstPacketSent = false; 194 _dtmfEventFirstPacketSent = false;
198 _dtmfKey = key; 195 _dtmfKey = key;
199 _dtmfLengthSamples = (kDtmfFrequencyHz / 1000) * dtmfLengthMS; 196 _dtmfLengthSamples = (kDtmfFrequencyHz / 1000) * dtmfLengthMS;
200 dtmfToneStarted = true; 197 dtmfToneStarted = true;
201 _dtmfEventIsOn = true; 198 _dtmfEventIsOn = true;
202 } 199 }
203 } 200 }
204 } 201 }
205 if (dtmfToneStarted) { 202 if (dtmfToneStarted) {
206 if (_audioFeedback) 203 if (_audioFeedback)
207 _audioFeedback->OnPlayTelephoneEvent(_id, key, dtmfLengthMS, _dtmfLevel); 204 _audioFeedback->OnPlayTelephoneEvent(key, dtmfLengthMS, _dtmfLevel);
208 } 205 }
209 206
210 // A source MAY send events and coded audio packets for the same time 207 // A source MAY send events and coded audio packets for the same time
211 // but we don't support it 208 // but we don't support it
212 if (_dtmfEventIsOn) { 209 if (_dtmfEventIsOn) {
213 if (frameType == kFrameEmpty) { 210 if (frameType == kFrameEmpty) {
214 // kFrameEmpty is used to drive the DTMF when in CN mode 211 // kFrameEmpty is used to drive the DTMF when in CN mode
215 // it can be triggered more frequently than we want to send the 212 // it can be triggered more frequently than we want to send the
216 // DTMF packets. 213 // DTMF packets.
217 if (packet_size_samples > (captureTimeStamp - _dtmfTimestampLastSent)) { 214 if (packet_size_samples > (captureTimeStamp - _dtmfTimestampLastSent)) {
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 retVal = _rtpSender->SendToNetwork(dtmfbuffer, 4, 12, -1, 478 retVal = _rtpSender->SendToNetwork(dtmfbuffer, 4, 12, -1,
482 kAllowRetransmission, 479 kAllowRetransmission,
483 PacedSender::kHighPriority); 480 PacedSender::kHighPriority);
484 sendCount--; 481 sendCount--;
485 482
486 }while (sendCount > 0 && retVal == 0); 483 }while (sendCount > 0 && retVal == 0);
487 484
488 return retVal; 485 return retVal;
489 } 486 }
490 } // namespace webrtc 487 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_sender_audio.h ('k') | webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698