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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 RTPSender::RTPSender( | 107 RTPSender::RTPSender( |
108 bool audio, | 108 bool audio, |
109 Clock* clock, | 109 Clock* clock, |
110 Transport* transport, | 110 Transport* transport, |
111 RtpAudioFeedback* audio_feedback, | 111 RtpAudioFeedback* audio_feedback, |
112 RtpPacketSender* paced_sender, | 112 RtpPacketSender* paced_sender, |
113 TransportSequenceNumberAllocator* sequence_number_allocator, | 113 TransportSequenceNumberAllocator* sequence_number_allocator, |
114 TransportFeedbackObserver* transport_feedback_observer, | 114 TransportFeedbackObserver* transport_feedback_observer, |
115 BitrateStatisticsObserver* bitrate_callback, | 115 BitrateStatisticsObserver* bitrate_callback, |
116 FrameCountObserver* frame_count_observer, | 116 FrameCountObserver* frame_count_observer, |
117 SendSideDelayObserver* send_side_delay_observer, | 117 SendSideDelayObserver* send_side_delay_observer) |
118 RtcEventLog* event_log) | |
119 : clock_(clock), | 118 : clock_(clock), |
120 // TODO(holmer): Remove this conversion when we remove the use of | 119 // TODO(holmer): Remove this conversion when we remove the use of |
121 // TickTime. | 120 // TickTime. |
122 clock_delta_ms_(clock_->TimeInMilliseconds() - | 121 clock_delta_ms_(clock_->TimeInMilliseconds() - |
123 TickTime::MillisecondTimestamp()), | 122 TickTime::MillisecondTimestamp()), |
124 random_(clock_->TimeInMicroseconds()), | 123 random_(clock_->TimeInMicroseconds()), |
125 bitrates_(bitrate_callback), | 124 bitrates_(bitrate_callback), |
126 total_bitrate_sent_(clock, bitrates_.total_bitrate_observer()), | 125 total_bitrate_sent_(clock, bitrates_.total_bitrate_observer()), |
127 audio_configured_(audio), | 126 audio_configured_(audio), |
128 audio_(audio ? new RTPSenderAudio(clock, this, audio_feedback) : nullptr), | 127 audio_(audio ? new RTPSenderAudio(clock, this, audio_feedback) : nullptr), |
(...skipping 17 matching lines...) Expand all Loading... |
146 // NACK. | 145 // NACK. |
147 nack_byte_count_times_(), | 146 nack_byte_count_times_(), |
148 nack_byte_count_(), | 147 nack_byte_count_(), |
149 nack_bitrate_(clock, bitrates_.retransmit_bitrate_observer()), | 148 nack_bitrate_(clock, bitrates_.retransmit_bitrate_observer()), |
150 packet_history_(clock), | 149 packet_history_(clock), |
151 // Statistics | 150 // Statistics |
152 statistics_crit_(CriticalSectionWrapper::CreateCriticalSection()), | 151 statistics_crit_(CriticalSectionWrapper::CreateCriticalSection()), |
153 rtp_stats_callback_(NULL), | 152 rtp_stats_callback_(NULL), |
154 frame_count_observer_(frame_count_observer), | 153 frame_count_observer_(frame_count_observer), |
155 send_side_delay_observer_(send_side_delay_observer), | 154 send_side_delay_observer_(send_side_delay_observer), |
156 event_log_(event_log), | 155 event_log_crit_(CriticalSectionWrapper::CreateCriticalSection()), |
| 156 event_log_(nullptr), |
157 // RTP variables | 157 // RTP variables |
158 start_timestamp_forced_(false), | 158 start_timestamp_forced_(false), |
159 start_timestamp_(0), | 159 start_timestamp_(0), |
160 ssrc_db_(SSRCDatabase::GetSSRCDatabase()), | 160 ssrc_db_(SSRCDatabase::GetSSRCDatabase()), |
161 remote_ssrc_(0), | 161 remote_ssrc_(0), |
162 sequence_number_forced_(false), | 162 sequence_number_forced_(false), |
163 ssrc_forced_(false), | 163 ssrc_forced_(false), |
164 timestamp_(0), | 164 timestamp_(0), |
165 capture_time_ms_(0), | 165 capture_time_ms_(0), |
166 last_timestamp_time_ms_(0), | 166 last_timestamp_time_ms_(0), |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 } | 750 } |
751 | 751 |
752 bool RTPSender::SendPacketToNetwork(const uint8_t* packet, | 752 bool RTPSender::SendPacketToNetwork(const uint8_t* packet, |
753 size_t size, | 753 size_t size, |
754 const PacketOptions& options) { | 754 const PacketOptions& options) { |
755 int bytes_sent = -1; | 755 int bytes_sent = -1; |
756 if (transport_) { | 756 if (transport_) { |
757 bytes_sent = transport_->SendRtp(packet, size, options) | 757 bytes_sent = transport_->SendRtp(packet, size, options) |
758 ? static_cast<int>(size) | 758 ? static_cast<int>(size) |
759 : -1; | 759 : -1; |
| 760 CriticalSectionScoped lock(event_log_crit_.get()); |
760 if (event_log_ && bytes_sent > 0) { | 761 if (event_log_ && bytes_sent > 0) { |
761 event_log_->LogRtpHeader(kOutgoingPacket, MediaType::ANY, packet, size); | 762 event_log_->LogRtpHeader(kOutgoingPacket, MediaType::ANY, packet, size); |
762 } | 763 } |
763 } | 764 } |
764 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), | 765 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), |
765 "RTPSender::SendPacketToNetwork", "size", size, "sent", | 766 "RTPSender::SendPacketToNetwork", "size", size, "sent", |
766 bytes_sent); | 767 bytes_sent); |
767 // TODO(pwestin): Add a separate bitrate for sent bitrate after pacer. | 768 // TODO(pwestin): Add a separate bitrate for sent bitrate after pacer. |
768 if (bytes_sent <= 0) { | 769 if (bytes_sent <= 0) { |
769 LOG(LS_WARNING) << "Transport failed to send packet"; | 770 LOG(LS_WARNING) << "Transport failed to send packet"; |
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1910 RtpState RTPSender::GetRtxRtpState() const { | 1911 RtpState RTPSender::GetRtxRtpState() const { |
1911 rtc::CritScope lock(&send_critsect_); | 1912 rtc::CritScope lock(&send_critsect_); |
1912 | 1913 |
1913 RtpState state; | 1914 RtpState state; |
1914 state.sequence_number = sequence_number_rtx_; | 1915 state.sequence_number = sequence_number_rtx_; |
1915 state.start_timestamp = start_timestamp_; | 1916 state.start_timestamp = start_timestamp_; |
1916 | 1917 |
1917 return state; | 1918 return state; |
1918 } | 1919 } |
1919 | 1920 |
| 1921 void RTPSender::SetRtcEventLog(webrtc::RtcEventLog* event_log) { |
| 1922 CriticalSectionScoped lock(event_log_crit_.get()); |
| 1923 event_log_ = event_log; |
| 1924 } |
1920 } // namespace webrtc | 1925 } // namespace webrtc |
OLD | NEW |