Chromium Code Reviews| 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 is the main interface for the cast transport sender. It accepts encoded | 5 // This is the main interface for the cast transport sender. It accepts encoded |
| 6 // frames (both audio and video), encrypts their encoded data, packetizes them | 6 // frames (both audio and video), encrypts their encoded data, packetizes them |
| 7 // and feeds them into a transport (e.g., UDP). | 7 // and feeds them into a transport (e.g., UDP). |
| 8 | 8 |
| 9 // Construction of the Cast Sender and the Cast Transport Sender should be done | 9 // Construction of the Cast Sender and the Cast Transport Sender should be done |
| 10 // in the following order: | 10 // in the following order: |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 typedef base::Callback<void(CastTransportStatus status)> | 49 typedef base::Callback<void(CastTransportStatus status)> |
| 50 CastTransportStatusCallback; | 50 CastTransportStatusCallback; |
| 51 | 51 |
| 52 typedef base::Callback<void(scoped_ptr<std::vector<FrameEvent>>, | 52 typedef base::Callback<void(scoped_ptr<std::vector<FrameEvent>>, |
| 53 scoped_ptr<std::vector<PacketEvent>>)> | 53 scoped_ptr<std::vector<PacketEvent>>)> |
| 54 BulkRawEventsCallback; | 54 BulkRawEventsCallback; |
| 55 | 55 |
| 56 // The application should only trigger this class from the transport thread. | 56 // The application should only trigger this class from the transport thread. |
| 57 class CastTransportSender : public base::NonThreadSafe { | 57 class CastTransportSender : public base::NonThreadSafe { |
| 58 public: | 58 public: |
| 59 static scoped_ptr<CastTransportSender> Create( | 59 // Interface to create a cast transport sender / receiver. |
|
Irfan
2015/12/15 22:23:13
Perhaps the name of the class should be CastTransp
xjz
2015/12/16 18:11:34
Rename it to CastTransportClient.
| |
| 60 net::NetLog* net_log, | 60 class Client { |
| 61 base::TickClock* clock, | 61 public: |
| 62 const net::IPEndPoint& local_end_point, | 62 virtual void OnStatusChange(CastTransportStatus status) = 0; |
|
Irfan
2015/12/15 22:23:13
Comment suggestion: "Audio and video transport sta
xjz
2015/12/16 18:11:34
Done.
| |
| 63 const net::IPEndPoint& remote_end_point, | 63 // Raw events call back. This will be involked every |
|
Irfan
2015/12/15 22:23:13
s/involked/invoked
Suggestion: "Raw events will b
xjz
2015/12/16 18:11:34
Done.
| |
| 64 scoped_ptr<base::DictionaryValue> options, | 64 // |logging_flush_interval|. It could be no-op function if user is not |
| 65 const CastTransportStatusCallback& status_callback, | 65 // interested in raw events. |logging_flush_interval| should be set to |
| 66 const BulkRawEventsCallback& raw_events_callback, | 66 // |base::TimeDelta| in this case. |
| 67 base::TimeDelta raw_events_callback_interval, | 67 virtual void OnReceivedLoggingEvents( |
| 68 const PacketReceiverCallback& packet_callback, | 68 scoped_ptr<std::vector<FrameEvent>>, |
| 69 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner); | 69 scoped_ptr<std::vector<PacketEvent>>) = 0; |
| 70 // Return false if user is provided a no-op function. | |
|
Irfan
2015/12/15 22:23:13
It appears the return status is only used for logg
xjz
2015/12/16 18:11:34
Done.
| |
| 71 virtual bool OnReceivedPackets(scoped_ptr<Packet> packet) = 0; | |
|
Irfan
2015/12/15 22:23:13
There seems to be a comment in the old code relate
xjz
2015/12/16 18:11:34
This would only happen on errors.
| |
| 72 | |
| 73 protected: | |
| 74 virtual ~Client(); | |
| 75 }; | |
| 76 | |
| 77 // Parameters to create a cast transport sender / receiver. | |
| 78 // |options| contains optional settings for the transport, possible | |
| 79 // keys are: | |
| 80 // "DSCP" (value ignored) | |
| 81 // - Turns DSCP on (higher IP Precedence and Type of Service). | |
| 82 // "disable_non_blocking_io" (value ignored) | |
| 83 // - Windows only. Turns off non-blocking IO for the socket. | |
| 84 // Note: Non-blocking IO is, by default, enabled on all platforms. | |
| 85 // "pacer_target_burst_size": int | |
| 86 // - Specifies how many packets to send per 10 ms ideally. | |
| 87 // "pacer_max_burst_size": int | |
| 88 // - Specifies how many pakcets to send per 10 ms, maximum. | |
| 89 // "send_buffer_min_size": int | |
| 90 // - Specifies the minimum socket send buffer size. | |
| 91 // "disable_wifi_scan" (value ignored) | |
| 92 // - Disable wifi scans while streaming. | |
| 93 // "media_streaming_mode" (value ignored) | |
| 94 // - Turn media streaming mode on. | |
| 95 // Note, these options may be ignored on some platforms. | |
| 96 struct CreateParams { | |
| 97 CreateParams( | |
| 98 net::NetLog* log, | |
| 99 base::TickClock* input_clock, | |
| 100 net::IPEndPoint local_addr, | |
| 101 net::IPEndPoint remote_addr, | |
| 102 Client* transport_client, | |
| 103 base::TimeDelta transport_logging_flush_interval, | |
| 104 scoped_ptr<base::DictionaryValue> options, | |
| 105 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); | |
| 106 ~CreateParams(); | |
| 107 | |
| 108 net::NetLog* net_log; | |
| 109 base::TickClock* clock; | |
| 110 net::IPEndPoint local_end_point; | |
| 111 net::IPEndPoint remote_end_point; | |
| 112 Client* client; | |
| 113 base::TimeDelta logging_flush_interval; | |
| 114 scoped_ptr<base::DictionaryValue> optional_config; | |
| 115 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner; | |
| 116 }; | |
| 117 | |
| 118 static scoped_ptr<CastTransportSender> Create(const CreateParams& params); | |
| 70 | 119 |
| 71 virtual ~CastTransportSender() {} | 120 virtual ~CastTransportSender() {} |
| 72 | 121 |
| 73 // Audio/Video initialization. | 122 // Audio/Video initialization. |
| 74 // Encoded frames cannot be transmitted until the relevant initialize method | 123 // Encoded frames cannot be transmitted until the relevant initialize method |
| 75 // is called. | 124 // is called. |
| 76 virtual void InitializeAudio(const CastTransportRtpConfig& config, | 125 virtual void InitializeAudio(const CastTransportRtpConfig& config, |
| 77 const RtcpCastMessageCallback& cast_message_cb, | 126 const RtcpCastMessageCallback& cast_message_cb, |
| 78 const RtcpRttCallback& rtt_cb) = 0; | 127 const RtcpRttCallback& rtt_cb) = 0; |
| 79 virtual void InitializeVideo(const CastTransportRtpConfig& config, | 128 virtual void InitializeVideo(const CastTransportRtpConfig& config, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 const RtcpCastMessage* cast_message, | 170 const RtcpCastMessage* cast_message, |
| 122 base::TimeDelta target_delay, | 171 base::TimeDelta target_delay, |
| 123 const ReceiverRtcpEventSubscriber::RtcpEvents* rtcp_events, | 172 const ReceiverRtcpEventSubscriber::RtcpEvents* rtcp_events, |
| 124 const RtpReceiverStatistics* rtp_receiver_statistics) = 0; | 173 const RtpReceiverStatistics* rtp_receiver_statistics) = 0; |
| 125 }; | 174 }; |
| 126 | 175 |
| 127 } // namespace cast | 176 } // namespace cast |
| 128 } // namespace media | 177 } // namespace media |
| 129 | 178 |
| 130 #endif // MEDIA_CAST_NET_CAST_TRANSPORT_SENDER_H_ | 179 #endif // MEDIA_CAST_NET_CAST_TRANSPORT_SENDER_H_ |
| OLD | NEW |