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

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

Issue 1515023002: Simplify interface for media/cast: CastTransportSenderImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months 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 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 typedef base::Callback<void(CastTransportStatus status)> 50 typedef base::Callback<void(CastTransportStatus status)>
51 CastTransportStatusCallback; 51 CastTransportStatusCallback;
52 52
53 typedef base::Callback<void(scoped_ptr<std::vector<FrameEvent>>, 53 typedef base::Callback<void(scoped_ptr<std::vector<FrameEvent>>,
54 scoped_ptr<std::vector<PacketEvent>>)> 54 scoped_ptr<std::vector<PacketEvent>>)>
55 BulkRawEventsCallback; 55 BulkRawEventsCallback;
56 56
57 // The application should only trigger this class from the transport thread. 57 // The application should only trigger this class from the transport thread.
58 class CastTransportSender : public base::NonThreadSafe { 58 class CastTransportSender : public base::NonThreadSafe {
59 public: 59 public:
60 // Interface used for receiving status updates, raw events, and out-of-band
miu 2016/01/16 02:28:42 s/out-of-band incoming/RTP/ See comment below...
xjz 2016/01/21 19:16:27 Done.
61 // incomming packets from CastTransportSender.
62 class Client {
63 public:
64 virtual ~Client(){};
65 // Audio and Video transport status change is reported on this callback.
66 virtual void OnStatusChanged(CastTransportStatus status) = 0;
67
68 // Raw events will be invoked on this callback every
69 // |logging_flush_interval| if it is greater than |base::TimeDelta()|.
miu 2016/01/16 02:28:42 Suggest replacing "every |logging_flush_interval|
xjz 2016/01/21 19:16:27 Done.
70 virtual void OnLoggingEventsReceived(
71 scoped_ptr<std::vector<FrameEvent>> frame_events,
72 scoped_ptr<std::vector<PacketEvent>> packet_events) = 0;
73
74 // Incoming packets that do not match the channels created by
75 // Initialize{Audio,Video} will report to this callback.
76 virtual void OnPacketsReceived(scoped_ptr<Packet> packet) = 0;
miu 2016/01/16 02:28:42 This is how an RTP packet is delivered. So, this
xjz 2016/01/21 19:16:27 Done. Named it ProcessRtpPacket().
77 };
78
79 // Parameters used to create udp transport.
80 struct UdpTransportParams {
81 UdpTransportParams(net::NetLog* log, // Owned by the caller.
82 net::IPEndPoint local_addr,
83 net::IPEndPoint remote_addr)
84 : net_log(log),
85 local_end_point(local_addr),
86 remote_end_point(remote_addr) {}
87
88 net::NetLog* net_log;
89 net::IPEndPoint local_end_point;
90 net::IPEndPoint remote_end_point;
91 };
92
93 // Parameters to create a cast transport sender / receiver.
94 // |options| contains optional settings for the transport, possible
95 // keys are:
96 // "DSCP" (value ignored)
97 // - Turns DSCP on (higher IP Precedence and Type of Service).
98 // "disable_non_blocking_io" (value ignored)
99 // - Windows only. Turns off non-blocking IO for the socket.
100 // Note: Non-blocking IO is, by default, enabled on all platforms.
101 // "pacer_target_burst_size": int
102 // - Specifies how many packets to send per 10 ms ideally.
103 // "pacer_max_burst_size": int
104 // - Specifies how many pakcets to send per 10 ms, maximum.
105 // "send_buffer_min_size": int
106 // - Specifies the minimum socket send buffer size.
107 // "disable_wifi_scan" (value ignored)
108 // - Disable wifi scans while streaming.
109 // "media_streaming_mode" (value ignored)
110 // - Turn media streaming mode on.
111 // Note, these options may be ignored on some platforms.
60 static scoped_ptr<CastTransportSender> Create( 112 static scoped_ptr<CastTransportSender> Create(
61 net::NetLog* net_log, 113 base::TickClock* clock, // Owned by the caller.
62 base::TickClock* clock, 114 const UdpTransportParams& upd_transport_params,
63 const net::IPEndPoint& local_end_point, 115 base::TimeDelta logging_flush_interval,
64 const net::IPEndPoint& remote_end_point,
65 scoped_ptr<base::DictionaryValue> options, 116 scoped_ptr<base::DictionaryValue> options,
66 const CastTransportStatusCallback& status_callback, 117 scoped_ptr<Client> client,
67 const BulkRawEventsCallback& raw_events_callback,
68 base::TimeDelta raw_events_callback_interval,
69 const PacketReceiverCallback& packet_callback,
70 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner); 118 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner);
71 119
72 virtual ~CastTransportSender() {} 120 virtual ~CastTransportSender() {}
73 121
74 // Audio/Video initialization. 122 // Audio/Video initialization.
75 // Encoded frames cannot be transmitted until the relevant initialize method 123 // Encoded frames cannot be transmitted until the relevant initialize method
76 // is called. 124 // is called.
77 virtual void InitializeAudio(const CastTransportRtpConfig& config, 125 virtual void InitializeAudio(const CastTransportRtpConfig& config,
78 const RtcpCastMessageCallback& cast_message_cb, 126 const RtcpCastMessageCallback& cast_message_cb,
79 const RtcpRttCallback& rtt_cb) = 0; 127 const RtcpRttCallback& rtt_cb) = 0;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 const RtcpCastMessage* cast_message, 169 const RtcpCastMessage* cast_message,
122 base::TimeDelta target_delay, 170 base::TimeDelta target_delay,
123 const ReceiverRtcpEventSubscriber::RtcpEvents* rtcp_events, 171 const ReceiverRtcpEventSubscriber::RtcpEvents* rtcp_events,
124 const RtpReceiverStatistics* rtp_receiver_statistics) = 0; 172 const RtpReceiverStatistics* rtp_receiver_statistics) = 0;
125 }; 173 };
126 174
127 } // namespace cast 175 } // namespace cast
128 } // namespace media 176 } // namespace media
129 177
130 #endif // MEDIA_CAST_NET_CAST_TRANSPORT_SENDER_H_ 178 #endif // MEDIA_CAST_NET_CAST_TRANSPORT_SENDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698