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

Side by Side Diff: media/cast/net/cast_transport_sender_impl.h

Issue 1515023002: Simplify interface for media/cast: CastTransportSenderImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 // 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 // This class maintains a send transport for audio and video in a Cast 5 // This class maintains a send transport for audio and video in a Cast
6 // Streaming session. 6 // Streaming session.
7 // Audio, video frames and RTCP messages are submitted to this object 7 // Audio, video frames and RTCP messages are submitted to this object
8 // and then packetized and paced to the underlying UDP socket. 8 // and then packetized and paced to the underlying UDP socket.
9 // 9 //
10 // The hierarchy of send transport in a Cast Streaming session: 10 // The hierarchy of send transport in a Cast Streaming session:
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // "send_buffer_min_size": int 71 // "send_buffer_min_size": int
72 // - Specifies the minimum socket send buffer size. 72 // - Specifies the minimum socket send buffer size.
73 // "disable_wifi_scan" (value ignored) 73 // "disable_wifi_scan" (value ignored)
74 // - Disable wifi scans while streaming. 74 // - Disable wifi scans while streaming.
75 // "media_streaming_mode" (value ignored) 75 // "media_streaming_mode" (value ignored)
76 // - Turn media streaming mode on. 76 // - Turn media streaming mode on.
77 // Note, these options may be ignored on some platforms. 77 // Note, these options may be ignored on some platforms.
78 // TODO(hubbe): Too many callbacks, replace with an interface. 78 // TODO(hubbe): Too many callbacks, replace with an interface.
79 // http://crbug.com/557477 79 // http://crbug.com/557477
80 CastTransportSenderImpl( 80 CastTransportSenderImpl(
81 net::NetLog* net_log, 81 base::WeakPtr<CastTransportSenderInfo> cast_transport_sender_info,
82 base::TickClock* clock, 82 base::TickClock* clock,
83 const net::IPEndPoint& local_end_point,
84 const net::IPEndPoint& remote_end_point,
85 scoped_ptr<base::DictionaryValue> options,
86 const CastTransportStatusCallback& status_callback,
87 const BulkRawEventsCallback& raw_events_callback,
88 base::TimeDelta raw_events_callback_interval,
89 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner, 83 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner,
90 const PacketReceiverCallback& packet_callback,
91 PacketSender* external_transport); 84 PacketSender* external_transport);
92 85
93 ~CastTransportSenderImpl() final; 86 ~CastTransportSenderImpl() final;
94 87
95 // CastTransportSender implementation. 88 // CastTransportSender implementation.
96 void InitializeAudio(const CastTransportRtpConfig& config, 89 void InitializeAudio(const CastTransportRtpConfig& config,
97 const RtcpCastMessageCallback& cast_message_cb, 90 const RtcpCastMessageCallback& cast_message_cb,
98 const RtcpRttCallback& rtt_cb) final; 91 const RtcpRttCallback& rtt_cb) final;
99 void InitializeVideo(const CastTransportRtpConfig& config, 92 void InitializeVideo(const CastTransportRtpConfig& config,
100 const RtcpCastMessageCallback& cast_message_cb, 93 const RtcpCastMessageCallback& cast_message_cb,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 142
150 // Called when a log message is received. 143 // Called when a log message is received.
151 void OnReceivedLogMessage(EventMediaType media_type, 144 void OnReceivedLogMessage(EventMediaType media_type,
152 const RtcpReceiverLogMessage& log); 145 const RtcpReceiverLogMessage& log);
153 146
154 // Called when a RTCP Cast message is received. 147 // Called when a RTCP Cast message is received.
155 void OnReceivedCastMessage(uint32 ssrc, 148 void OnReceivedCastMessage(uint32 ssrc,
156 const RtcpCastMessageCallback& cast_message_cb, 149 const RtcpCastMessageCallback& cast_message_cb,
157 const RtcpCastMessage& cast_message); 150 const RtcpCastMessage& cast_message);
158 151
152 base::WeakPtr<CastTransportSenderInfo> cast_transport_sender_info_;
159 base::TickClock* clock_; // Not owned by this class. 153 base::TickClock* clock_; // Not owned by this class.
160 CastTransportStatusCallback status_callback_;
161 scoped_refptr<base::SingleThreadTaskRunner> transport_task_runner_; 154 scoped_refptr<base::SingleThreadTaskRunner> transport_task_runner_;
162 155
163 // FrameEvents and PacketEvents pending delivery via |raw_events_callback_|. 156 // FrameEvents and PacketEvents pending delivery via |raw_events_callback_|.
164 // Do not add elements to these when |raw_events_callback_.is_null()|. 157 // Do not add elements to these when |raw_events_callback_.is_null()|.
165 std::vector<FrameEvent> recent_frame_events_; 158 std::vector<FrameEvent> recent_frame_events_;
166 std::vector<PacketEvent> recent_packet_events_; 159 std::vector<PacketEvent> recent_packet_events_;
167 160
168 // Interface to a UDP socket. 161 // Interface to a UDP socket.
169 scoped_ptr<UdpTransport> transport_; 162 scoped_ptr<UdpTransport> transport_;
170 163
171 // Packet sender that performs pacing. 164 // Packet sender that performs pacing.
172 PacedSender pacer_; 165 PacedSender pacer_;
173 166
174 // Packetizer for audio and video frames. 167 // Packetizer for audio and video frames.
175 scoped_ptr<RtpSender> audio_sender_; 168 scoped_ptr<RtpSender> audio_sender_;
176 scoped_ptr<RtpSender> video_sender_; 169 scoped_ptr<RtpSender> video_sender_;
177 170
178 // Maintains RTCP session for audio and video. 171 // Maintains RTCP session for audio and video.
179 scoped_ptr<Rtcp> audio_rtcp_session_; 172 scoped_ptr<Rtcp> audio_rtcp_session_;
180 scoped_ptr<Rtcp> video_rtcp_session_; 173 scoped_ptr<Rtcp> video_rtcp_session_;
181 174
182 // Encrypts data in EncodedFrames before they are sent. Note that it's 175 // Encrypts data in EncodedFrames before they are sent. Note that it's
183 // important for the encryption to happen here, in code that would execute in 176 // important for the encryption to happen here, in code that would execute in
184 // the main browser process, for security reasons. This helps to mitigate 177 // the main browser process, for security reasons. This helps to mitigate
185 // the damage that could be caused by a compromised renderer process. 178 // the damage that could be caused by a compromised renderer process.
186 TransportEncryptionHandler audio_encryptor_; 179 TransportEncryptionHandler audio_encryptor_;
187 TransportEncryptionHandler video_encryptor_; 180 TransportEncryptionHandler video_encryptor_;
188 181
189 BulkRawEventsCallback raw_events_callback_;
190 base::TimeDelta raw_events_callback_interval_; 182 base::TimeDelta raw_events_callback_interval_;
191 183
192 // Right after a frame is sent we record the number of bytes sent to the 184 // Right after a frame is sent we record the number of bytes sent to the
193 // socket. We record the corresponding bytes sent for the most recent ACKed 185 // socket. We record the corresponding bytes sent for the most recent ACKed
194 // audio packet. 186 // audio packet.
195 int64 last_byte_acked_for_audio_; 187 int64 last_byte_acked_for_audio_;
196 188
197 // Packets that don't match these ssrcs are ignored. 189 // Packets that don't match these ssrcs are ignored.
198 std::set<uint32> valid_ssrcs_; 190 std::set<uint32> valid_ssrcs_;
199 191
200 // Called with incoming packets. (Unless they match the
201 // channels created by Initialize{Audio,Video}.
202 PacketReceiverCallback packet_callback_;
203
204 scoped_ptr<net::ScopedWifiOptions> wifi_options_autoreset_; 192 scoped_ptr<net::ScopedWifiOptions> wifi_options_autoreset_;
205 193
206 base::WeakPtrFactory<CastTransportSenderImpl> weak_factory_; 194 base::WeakPtrFactory<CastTransportSenderImpl> weak_factory_;
207 195
208 DISALLOW_COPY_AND_ASSIGN(CastTransportSenderImpl); 196 DISALLOW_COPY_AND_ASSIGN(CastTransportSenderImpl);
209 }; 197 };
210 198
211 } // namespace cast 199 } // namespace cast
212 } // namespace media 200 } // namespace media
213 201
214 #endif // MEDIA_CAST_NET_CAST_TRANSPORT_SENDER_IMPL_H_ 202 #endif // MEDIA_CAST_NET_CAST_TRANSPORT_SENDER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698