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 // 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: |
11 // | 11 // |
12 // CastTransportSender RTP RTCP | 12 // CastTransportSender RTP RTCP |
13 // ------------------------------------------------------------------ | 13 // ------------------------------------------------------------------ |
14 // TransportEncryptionHandler (A/V) | 14 // TransportEncryptionHandler (A/V) |
15 // RtpSender (A/V) Rtcp (A/V) | 15 // RtpSender (A/V) Rtcp (A/V) |
16 // PacedSender (Shared) | 16 // PacedSender (Shared) |
17 // UdpTransport (Shared) | 17 // UdpTransport (Shared) |
18 // | 18 // |
19 // There are objects of TransportEncryptionHandler, RtpSender and Rtcp | 19 // There are objects of TransportEncryptionHandler, RtpSender and Rtcp |
20 // for each audio and video stream. | 20 // for each audio and video stream. |
21 // PacedSender and UdpTransport are shared between all RTP and RTCP | 21 // PacedSender and UdpTransport are shared between all RTP and RTCP |
22 // streams. | 22 // streams. |
23 | 23 |
24 #ifndef MEDIA_CAST_NET_CAST_TRANSPORT_IMPL_H_ | 24 #ifndef MEDIA_CAST_NET_CAST_TRANSPORT_IMPL_H_ |
25 #define MEDIA_CAST_NET_CAST_TRANSPORT_IMPL_H_ | 25 #define MEDIA_CAST_NET_CAST_TRANSPORT_IMPL_H_ |
26 | 26 |
27 #include "base/callback.h" | 27 #include "base/callback.h" |
28 #include "base/gtest_prod_util.h" | 28 #include "base/gtest_prod_util.h" |
| 29 #include "base/memory/lifetime_interface.h" |
29 #include "base/memory/ref_counted.h" | 30 #include "base/memory/ref_counted.h" |
30 #include "base/memory/scoped_ptr.h" | 31 #include "base/memory/scoped_ptr.h" |
31 #include "base/memory/weak_ptr.h" | 32 #include "base/memory/weak_ptr.h" |
32 #include "base/time/tick_clock.h" | 33 #include "base/time/tick_clock.h" |
33 #include "base/time/time.h" | 34 #include "base/time/time.h" |
34 #include "base/timer/timer.h" | 35 #include "base/timer/timer.h" |
35 #include "media/cast/common/transport_encryption_handler.h" | 36 #include "media/cast/common/transport_encryption_handler.h" |
36 #include "media/cast/logging/logging_defines.h" | 37 #include "media/cast/logging/logging_defines.h" |
37 #include "media/cast/logging/simple_event_subscriber.h" | 38 #include "media/cast/logging/simple_event_subscriber.h" |
38 #include "media/cast/net/cast_transport_config.h" | 39 #include "media/cast/net/cast_transport_config.h" |
(...skipping 10 matching lines...) Expand all Loading... |
49 class CastTransportSenderImpl : public CastTransportSender { | 50 class CastTransportSenderImpl : public CastTransportSender { |
50 public: | 51 public: |
51 // |external_transport| is only used for testing. | 52 // |external_transport| is only used for testing. |
52 // |raw_events_callback|: Raw events will be returned on this callback | 53 // |raw_events_callback|: Raw events will be returned on this callback |
53 // which will be invoked every |raw_events_callback_interval|. | 54 // which will be invoked every |raw_events_callback_interval|. |
54 // This can be a null callback, i.e. if user is not interested in raw events. | 55 // This can be a null callback, i.e. if user is not interested in raw events. |
55 // |raw_events_callback_interval|: This can be |base::TimeDelta()| if | 56 // |raw_events_callback_interval|: This can be |base::TimeDelta()| if |
56 // |raw_events_callback| is a null callback. | 57 // |raw_events_callback| is a null callback. |
57 // |options| contains optional settings for the transport, possible | 58 // |options| contains optional settings for the transport, possible |
58 // keys are: | 59 // keys are: |
59 // "DSCP" (value doesn't matter) - turns DSCP on | 60 // "DSCP" (value ignored) - turns DSCP on |
60 // "pacer_target_burst_size": int - specifies how many packets to send | 61 // "pacer_target_burst_size": int - specifies how many packets to send |
61 // per 10 ms ideally. | 62 // per 10 ms ideally. |
62 // "pacer_max_burst_size": int - specifies how many pakcets to send | 63 // "pacer_max_burst_size": int - specifies how many pakcets to send |
63 // per 10 ms, max | 64 // per 10 ms, max |
| 65 // "disable_wifi_scan" (value ignored) - disable wifi scans while streaming |
| 66 // "media_streaming_mode" (value ignored) - turn media streaming mode on |
| 67 // Note, these options may be ignored on some platforms. |
64 CastTransportSenderImpl( | 68 CastTransportSenderImpl( |
65 net::NetLog* net_log, | 69 net::NetLog* net_log, |
66 base::TickClock* clock, | 70 base::TickClock* clock, |
67 const net::IPEndPoint& remote_end_point, | 71 const net::IPEndPoint& remote_end_point, |
68 scoped_ptr<base::DictionaryValue> options, | 72 scoped_ptr<base::DictionaryValue> options, |
69 const CastTransportStatusCallback& status_callback, | 73 const CastTransportStatusCallback& status_callback, |
70 const BulkRawEventsCallback& raw_events_callback, | 74 const BulkRawEventsCallback& raw_events_callback, |
71 base::TimeDelta raw_events_callback_interval, | 75 base::TimeDelta raw_events_callback_interval, |
72 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner, | 76 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner, |
73 PacketSender* external_transport); | 77 PacketSender* external_transport); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 scoped_ptr<SimpleEventSubscriber> event_subscriber_; | 162 scoped_ptr<SimpleEventSubscriber> event_subscriber_; |
159 | 163 |
160 BulkRawEventsCallback raw_events_callback_; | 164 BulkRawEventsCallback raw_events_callback_; |
161 base::TimeDelta raw_events_callback_interval_; | 165 base::TimeDelta raw_events_callback_interval_; |
162 | 166 |
163 // Right after a frame is sent we record the number of bytes sent to the | 167 // Right after a frame is sent we record the number of bytes sent to the |
164 // socket. We record the corresponding bytes sent for the most recent ACKed | 168 // socket. We record the corresponding bytes sent for the most recent ACKed |
165 // audio packet. | 169 // audio packet. |
166 int64 last_byte_acked_for_audio_; | 170 int64 last_byte_acked_for_audio_; |
167 | 171 |
| 172 scoped_ptr<base::LifetimeInterface> wifi_options_autoreset_; |
| 173 |
168 base::WeakPtrFactory<CastTransportSenderImpl> weak_factory_; | 174 base::WeakPtrFactory<CastTransportSenderImpl> weak_factory_; |
169 | 175 |
170 DISALLOW_COPY_AND_ASSIGN(CastTransportSenderImpl); | 176 DISALLOW_COPY_AND_ASSIGN(CastTransportSenderImpl); |
171 }; | 177 }; |
172 | 178 |
173 } // namespace cast | 179 } // namespace cast |
174 } // namespace media | 180 } // namespace media |
175 | 181 |
176 #endif // MEDIA_CAST_NET_CAST_TRANSPORT_IMPL_H_ | 182 #endif // MEDIA_CAST_NET_CAST_TRANSPORT_IMPL_H_ |
OLD | NEW |