Chromium Code Reviews| 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 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_AUDIO_H_ | 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_AUDIO_H_ | 
| 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_AUDIO_H_ | 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_AUDIO_H_ | 
| 13 | 13 | 
| 14 #include "webrtc/common_types.h" | 14 #include "webrtc/common_types.h" | 
| 15 #include "webrtc/base/criticalsection.h" | 15 #include "webrtc/base/criticalsection.h" | 
| 16 #include "webrtc/base/onetimeevent.h" | 16 #include "webrtc/base/onetimeevent.h" | 
| 17 #include "webrtc/modules/rtp_rtcp/source/dtmf_queue.h" | 17 #include "webrtc/modules/rtp_rtcp/source/dtmf_queue.h" | 
| 18 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h" | 18 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h" | 
| 19 #include "webrtc/modules/rtp_rtcp/source/rtp_sender.h" | 19 #include "webrtc/modules/rtp_rtcp/source/rtp_sender.h" | 
| 20 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 20 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 
| 21 #include "webrtc/typedefs.h" | 21 #include "webrtc/typedefs.h" | 
| 22 | 22 | 
| 23 namespace webrtc { | 23 namespace webrtc { | 
| 24 | |
| 24 class RTPSenderAudio : public DTMFqueue { | 25 class RTPSenderAudio : public DTMFqueue { | 
| 25 public: | 26 public: | 
| 26 RTPSenderAudio(Clock* clock, RTPSender* rtpSender); | 27 RTPSenderAudio(Clock* clock, RTPSender* rtp_sender); | 
| 27 virtual ~RTPSenderAudio(); | 28 virtual ~RTPSenderAudio(); | 
| 28 | 29 | 
| 29 int32_t RegisterAudioPayload(const char payloadName[RTP_PAYLOAD_NAME_SIZE], | 30 int32_t RegisterAudioPayload(const char payloadName[RTP_PAYLOAD_NAME_SIZE], | 
| 30 int8_t payloadType, | 31 int8_t payload_type, | 
| 
 
stefan-webrtc
2016/07/28 09:31:42
int here too
 
Sergey Ulanov
2016/07/28 18:01:34
Prefer to have it fixed in a separate CL.
 
 | |
| 31 uint32_t frequency, | 32 uint32_t frequency, | 
| 32 size_t channels, | 33 size_t channels, | 
| 33 uint32_t rate, | 34 uint32_t rate, | 
| 34 RtpUtility::Payload** payload); | 35 RtpUtility::Payload** payload); | 
| 35 | 36 | 
| 36 int32_t SendAudio(FrameType frameType, | 37 int32_t SendAudio(FrameType frame_type, | 
| 37 int8_t payloadType, | 38 int8_t payload_type, | 
| 38 uint32_t captureTimeStamp, | 39 uint32_t capture_timestamp, | 
| 39 const uint8_t* payloadData, | 40 const uint8_t* payload_data, | 
| 40 size_t payloadSize, | 41 size_t payload_size, | 
| 41 const RTPFragmentationHeader* fragmentation); | 42 const RTPFragmentationHeader* fragmentation); | 
| 42 | 43 | 
| 43 // set audio packet size, used to determine when it's time to send a DTMF | 44 // set audio packet size, used to determine when it's time to send a DTMF | 
| 44 // packet in silence (CNG) | 45 // packet in silence (CNG) | 
| 45 int32_t SetAudioPacketSize(uint16_t packetSizeSamples); | 46 int32_t SetAudioPacketSize(uint16_t packet_size_samples); | 
| 46 | 47 | 
| 47 // Store the audio level in dBov for | 48 // Store the audio level in dBov for | 
| 48 // header-extension-for-audio-level-indication. | 49 // header-extension-for-audio-level-indication. | 
| 49 // Valid range is [0,100]. Actual value is negative. | 50 // Valid range is [0,100]. Actual value is negative. | 
| 50 int32_t SetAudioLevel(uint8_t level_dBov); | 51 int32_t SetAudioLevel(uint8_t level_dbov); | 
| 51 | 52 | 
| 52 // Send a DTMF tone using RFC 2833 (4733) | 53 // Send a DTMF tone using RFC 2833 (4733) | 
| 53 int32_t SendTelephoneEvent(uint8_t key, uint16_t time_ms, uint8_t level); | 54 int32_t SendTelephoneEvent(uint8_t key, uint16_t time_ms, uint8_t level); | 
| 54 | 55 | 
| 55 int AudioFrequency() const; | 56 int AudioFrequency() const; | 
| 56 | 57 | 
| 57 // Set payload type for Redundant Audio Data RFC 2198 | 58 // Set payload type for Redundant Audio Data RFC 2198 | 
| 58 int32_t SetRED(int8_t payloadType); | 59 int32_t SetRED(int8_t payload_type); | 
| 59 | 60 | 
| 60 // Get payload type for Redundant Audio Data RFC 2198 | 61 // Get payload type for Redundant Audio Data RFC 2198 | 
| 61 int32_t RED(int8_t* payloadType) const; | 62 int32_t RED(int8_t* payload_type) const; | 
| 62 | 63 | 
| 63 protected: | 64 protected: | 
| 64 int32_t SendTelephoneEventPacket( | 65 int32_t SendTelephoneEventPacket( | 
| 65 bool ended, | 66 bool ended, | 
| 66 int8_t dtmf_payload_type, | 67 int8_t dtmf_payload_type, | 
| 67 uint32_t dtmfTimeStamp, | 68 uint32_t dtmf_timestamp, | 
| 68 uint16_t duration, | 69 uint16_t duration, | 
| 69 bool markerBit); // set on first packet in talk burst | 70 bool marker_bit); // set on first packet in talk burst | 
| 70 | 71 | 
| 71 bool MarkerBit(const FrameType frameType, const int8_t payloadType); | 72 bool MarkerBit(FrameType frame_type, int8_t payload_type); | 
| 72 | 73 | 
| 73 private: | 74 private: | 
| 74 Clock* const _clock; | 75 Clock* const clock_; | 
| 75 RTPSender* const _rtpSender; | 76 RTPSender* const rtp_sender_; | 
| 76 | 77 | 
| 77 rtc::CriticalSection _sendAudioCritsect; | 78 rtc::CriticalSection send_audio_critsect_; | 
| 78 | 79 | 
| 79 uint16_t _packetSizeSamples GUARDED_BY(_sendAudioCritsect); | 80 uint16_t packet_size_samples_ GUARDED_BY(send_audio_critsect_); | 
| 80 | 81 | 
| 81 // DTMF | 82 // DTMF. | 
| 82 bool _dtmfEventIsOn; | 83 bool dtmf_event_is_on_; | 
| 83 bool _dtmfEventFirstPacketSent; | 84 bool dtmf_event_first_packet_sent_; | 
| 84 int8_t _dtmfPayloadType GUARDED_BY(_sendAudioCritsect); | 85 int8_t dtmf_payload_type_ GUARDED_BY(send_audio_critsect_); | 
| 85 uint32_t _dtmfTimestamp; | 86 uint32_t dtmf_timestamp_; | 
| 86 uint8_t _dtmfKey; | 87 uint8_t dtmf_key_; | 
| 87 uint32_t _dtmfLengthSamples; | 88 uint32_t dtmf_length_samples_; | 
| 88 uint8_t _dtmfLevel; | 89 uint8_t dtmf_level_; | 
| 89 int64_t _dtmfTimeLastSent; | 90 int64_t dtmf_time_last_sent_; | 
| 90 uint32_t _dtmfTimestampLastSent; | 91 uint32_t dtmf_timestamp_last_sent_; | 
| 91 | 92 | 
| 92 int8_t _REDPayloadType GUARDED_BY(_sendAudioCritsect); | 93 int8_t red_payload_type_ GUARDED_BY(send_audio_critsect_); | 
| 93 | 94 | 
| 94 // VAD detection, used for markerbit | 95 // VAD detection, used for marker bit. | 
| 95 bool _inbandVADactive GUARDED_BY(_sendAudioCritsect); | 96 bool inband_vad_active_ GUARDED_BY(send_audio_critsect_); | 
| 96 int8_t _cngNBPayloadType GUARDED_BY(_sendAudioCritsect); | 97 int8_t cngnb_payload_type_ GUARDED_BY(send_audio_critsect_); | 
| 97 int8_t _cngWBPayloadType GUARDED_BY(_sendAudioCritsect); | 98 int8_t cngwb_payload_type_ GUARDED_BY(send_audio_critsect_); | 
| 98 int8_t _cngSWBPayloadType GUARDED_BY(_sendAudioCritsect); | 99 int8_t cngswb_payload_type_ GUARDED_BY(send_audio_critsect_); | 
| 99 int8_t _cngFBPayloadType GUARDED_BY(_sendAudioCritsect); | 100 int8_t cngfb_payload_type_ GUARDED_BY(send_audio_critsect_); | 
| 100 int8_t _lastPayloadType GUARDED_BY(_sendAudioCritsect); | 101 int8_t last_payload_type_ GUARDED_BY(send_audio_critsect_); | 
| 101 | 102 | 
| 102 // Audio level indication | 103 // Audio level indication. | 
| 103 // (https://datatracker.ietf.org/doc/draft-lennox-avt-rtp-audio-level-exthdr/) | 104 // (https://datatracker.ietf.org/doc/draft-lennox-avt-rtp-audio-level-exthdr/) | 
| 104 uint8_t _audioLevel_dBov GUARDED_BY(_sendAudioCritsect); | 105 uint8_t audio_level_dbov_ GUARDED_BY(send_audio_critsect_); | 
| 105 OneTimeEvent first_packet_sent_; | 106 OneTimeEvent first_packet_sent_; | 
| 106 }; | 107 }; | 
| 108 | |
| 107 } // namespace webrtc | 109 } // namespace webrtc | 
| 108 | 110 | 
| 109 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_AUDIO_H_ | 111 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_AUDIO_H_ | 
| OLD | NEW |