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 |
(...skipping 24 matching lines...) Expand all Loading... |
35 uint32_t rate, | 35 uint32_t rate, |
36 RtpUtility::Payload** payload); | 36 RtpUtility::Payload** payload); |
37 | 37 |
38 bool SendAudio(FrameType frame_type, | 38 bool SendAudio(FrameType frame_type, |
39 int8_t payload_type, | 39 int8_t payload_type, |
40 uint32_t capture_timestamp, | 40 uint32_t capture_timestamp, |
41 const uint8_t* payload_data, | 41 const uint8_t* payload_data, |
42 size_t payload_size, | 42 size_t payload_size, |
43 const RTPFragmentationHeader* fragmentation); | 43 const RTPFragmentationHeader* fragmentation); |
44 | 44 |
45 // set audio packet size, used to determine when it's time to send a DTMF | |
46 // packet in silence (CNG) | |
47 int32_t SetAudioPacketSize(uint16_t packet_size_samples); | |
48 | |
49 // Store the audio level in dBov for | 45 // Store the audio level in dBov for |
50 // header-extension-for-audio-level-indication. | 46 // header-extension-for-audio-level-indication. |
51 // Valid range is [0,100]. Actual value is negative. | 47 // Valid range is [0,100]. Actual value is negative. |
52 int32_t SetAudioLevel(uint8_t level_dbov); | 48 int32_t SetAudioLevel(uint8_t level_dbov); |
53 | 49 |
54 // Send a DTMF tone using RFC 2833 (4733) | 50 // Send a DTMF tone using RFC 2833 (4733) |
55 int32_t SendTelephoneEvent(uint8_t key, uint16_t time_ms, uint8_t level); | 51 int32_t SendTelephoneEvent(uint8_t key, uint16_t time_ms, uint8_t level); |
56 | 52 |
57 protected: | 53 protected: |
58 bool SendTelephoneEventPacket( | 54 bool SendTelephoneEventPacket( |
59 bool ended, | 55 bool ended, |
60 uint32_t dtmf_timestamp, | 56 uint32_t dtmf_timestamp, |
61 uint16_t duration, | 57 uint16_t duration, |
62 bool marker_bit); // set on first packet in talk burst | 58 bool marker_bit); // set on first packet in talk burst |
63 | 59 |
64 bool MarkerBit(FrameType frame_type, int8_t payload_type); | 60 bool MarkerBit(FrameType frame_type, int8_t payload_type); |
65 | 61 |
66 private: | 62 private: |
67 Clock* const clock_ = nullptr; | 63 Clock* const clock_ = nullptr; |
68 RTPSender* const rtp_sender_ = nullptr; | 64 RTPSender* const rtp_sender_ = nullptr; |
69 | 65 |
70 rtc::CriticalSection send_audio_critsect_; | 66 rtc::CriticalSection send_audio_critsect_; |
71 | 67 |
72 uint16_t packet_size_samples_ GUARDED_BY(send_audio_critsect_) = 160; | |
73 | |
74 // DTMF. | 68 // DTMF. |
75 bool dtmf_event_is_on_ = false; | 69 bool dtmf_event_is_on_ = false; |
76 bool dtmf_event_first_packet_sent_ = false; | 70 bool dtmf_event_first_packet_sent_ = false; |
77 int8_t dtmf_payload_type_ GUARDED_BY(send_audio_critsect_) = -1; | 71 int8_t dtmf_payload_type_ GUARDED_BY(send_audio_critsect_) = -1; |
78 uint32_t dtmf_payload_freq_ GUARDED_BY(send_audio_critsect_) = 8000; | 72 uint32_t dtmf_payload_freq_ GUARDED_BY(send_audio_critsect_) = 8000; |
79 uint32_t dtmf_timestamp_ = 0; | 73 uint32_t dtmf_timestamp_ = 0; |
80 uint32_t dtmf_length_samples_ = 0; | 74 uint32_t dtmf_length_samples_ = 0; |
81 int64_t dtmf_time_last_sent_ = 0; | 75 int64_t dtmf_time_last_sent_ = 0; |
82 uint32_t dtmf_timestamp_last_sent_ = 0; | 76 uint32_t dtmf_timestamp_last_sent_ = 0; |
83 DtmfQueue::Event dtmf_current_event_; | 77 DtmfQueue::Event dtmf_current_event_; |
(...skipping 11 matching lines...) Expand all Loading... |
95 // (https://datatracker.ietf.org/doc/draft-lennox-avt-rtp-audio-level-exthdr/) | 89 // (https://datatracker.ietf.org/doc/draft-lennox-avt-rtp-audio-level-exthdr/) |
96 uint8_t audio_level_dbov_ GUARDED_BY(send_audio_critsect_) = 0; | 90 uint8_t audio_level_dbov_ GUARDED_BY(send_audio_critsect_) = 0; |
97 OneTimeEvent first_packet_sent_; | 91 OneTimeEvent first_packet_sent_; |
98 | 92 |
99 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTPSenderAudio); | 93 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTPSenderAudio); |
100 }; | 94 }; |
101 | 95 |
102 } // namespace webrtc | 96 } // namespace webrtc |
103 | 97 |
104 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_AUDIO_H_ | 98 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_AUDIO_H_ |
OLD | NEW |