OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/cast/transport/cast_transport_sender_impl.h" | 5 #include "media/cast/transport/cast_transport_sender_impl.h" |
6 | 6 |
7 #include "base/single_thread_task_runner.h" | 7 #include "base/single_thread_task_runner.h" |
8 #include "media/cast/transport/cast_transport_config.h" | 8 #include "media/cast/transport/cast_transport_config.h" |
9 #include "media/cast/transport/cast_transport_defines.h" | 9 #include "media/cast/transport/cast_transport_defines.h" |
10 | 10 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 void CastTransportSenderImpl::InsertCodedVideoFrame( | 109 void CastTransportSenderImpl::InsertCodedVideoFrame( |
110 const EncodedVideoFrame* video_frame, | 110 const EncodedVideoFrame* video_frame, |
111 const base::TimeTicks& capture_time) { | 111 const base::TimeTicks& capture_time) { |
112 DCHECK(video_sender_) << "Video sender uninitialized"; | 112 DCHECK(video_sender_) << "Video sender uninitialized"; |
113 video_sender_->InsertCodedVideoFrame(video_frame, capture_time); | 113 video_sender_->InsertCodedVideoFrame(video_frame, capture_time); |
114 } | 114 } |
115 | 115 |
116 void CastTransportSenderImpl::SendRtcpFromRtpSender( | 116 void CastTransportSenderImpl::SendRtcpFromRtpSender( |
117 uint32 packet_type_flags, | 117 uint32 packet_type_flags, |
118 const RtcpSenderInfo& sender_info, | 118 uint32 ntp_seconds, |
| 119 uint32 ntp_fraction, |
| 120 uint32 rtp_timestamp, |
119 const RtcpDlrrReportBlock& dlrr, | 121 const RtcpDlrrReportBlock& dlrr, |
120 uint32 sending_ssrc, | 122 uint32 sending_ssrc, |
121 const std::string& c_name) { | 123 const std::string& c_name) { |
| 124 RtcpSenderInfo sender_info; |
| 125 sender_info.ntp_seconds = ntp_seconds; |
| 126 sender_info.ntp_fraction = ntp_fraction; |
| 127 sender_info.rtp_timestamp = rtp_timestamp; |
| 128 if (audio_sender_ && audio_sender_->ssrc() == sending_ssrc) { |
| 129 sender_info.send_packet_count = audio_sender_->send_packet_count(); |
| 130 sender_info.send_octet_count = audio_sender_->send_octet_count(); |
| 131 } else if (video_sender_ && video_sender_->ssrc() == sending_ssrc) { |
| 132 sender_info.send_packet_count = video_sender_->send_packet_count(); |
| 133 sender_info.send_octet_count = video_sender_->send_octet_count(); |
| 134 } else { |
| 135 LOG(ERROR) << "Sending RTCP with an invalid SSRC."; |
| 136 return; |
| 137 } |
122 rtcp_builder_.SendRtcpFromRtpSender( | 138 rtcp_builder_.SendRtcpFromRtpSender( |
123 packet_type_flags, sender_info, dlrr, sending_ssrc, c_name); | 139 packet_type_flags, sender_info, dlrr, sending_ssrc, c_name); |
124 } | 140 } |
125 | 141 |
126 void CastTransportSenderImpl::ResendPackets( | 142 void CastTransportSenderImpl::ResendPackets( |
127 bool is_audio, | 143 bool is_audio, |
128 const MissingFramesAndPacketsMap& missing_packets) { | 144 const MissingFramesAndPacketsMap& missing_packets) { |
129 if (is_audio) { | 145 if (is_audio) { |
130 DCHECK(audio_sender_) << "Audio sender uninitialized"; | 146 DCHECK(audio_sender_) << "Audio sender uninitialized"; |
131 audio_sender_->ResendPackets(missing_packets); | 147 audio_sender_->ResendPackets(missing_packets); |
132 } else { | 148 } else { |
133 DCHECK(video_sender_) << "Video sender uninitialized"; | 149 DCHECK(video_sender_) << "Video sender uninitialized"; |
134 video_sender_->ResendPackets(missing_packets); | 150 video_sender_->ResendPackets(missing_packets); |
135 } | 151 } |
136 } | 152 } |
137 | 153 |
138 void CastTransportSenderImpl::SubscribeAudioRtpStatsCallback( | |
139 const CastTransportRtpStatistics& callback) { | |
140 DCHECK(audio_sender_) << "Audio sender uninitialized"; | |
141 audio_sender_->SubscribeAudioRtpStatsCallback(callback); | |
142 } | |
143 | |
144 void CastTransportSenderImpl::SubscribeVideoRtpStatsCallback( | |
145 const CastTransportRtpStatistics& callback) { | |
146 DCHECK(video_sender_) << "Video sender uninitialized"; | |
147 video_sender_->SubscribeVideoRtpStatsCallback(callback); | |
148 } | |
149 | |
150 void CastTransportSenderImpl::SendRawEvents() { | 154 void CastTransportSenderImpl::SendRawEvents() { |
151 DCHECK(event_subscriber_.get()); | 155 DCHECK(event_subscriber_.get()); |
152 DCHECK(!raw_events_callback_.is_null()); | 156 DCHECK(!raw_events_callback_.is_null()); |
153 std::vector<PacketEvent> packet_events; | 157 std::vector<PacketEvent> packet_events; |
154 event_subscriber_->GetPacketEventsAndReset(&packet_events); | 158 event_subscriber_->GetPacketEventsAndReset(&packet_events); |
155 raw_events_callback_.Run(packet_events); | 159 raw_events_callback_.Run(packet_events); |
156 } | 160 } |
157 | 161 |
158 } // namespace transport | 162 } // namespace transport |
159 } // namespace cast | 163 } // namespace cast |
160 } // namespace media | 164 } // namespace media |
OLD | NEW |