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

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 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 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
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.
imcheng 2015/12/17 00:18:10 I don't think this comment is not accurate. If I u
xjz 2015/12/17 22:54:57 Done.
60 net::NetLog* net_log, 60 class Client {
61 base::TickClock* clock, 61 public:
62 const net::IPEndPoint& local_end_point, 62 // Audio and Video transport status change is reported on this callback.
63 const net::IPEndPoint& remote_end_point, 63 virtual void OnStatusChange(CastTransportStatus status) = 0;
64 scoped_ptr<base::DictionaryValue> options, 64
65 const CastTransportStatusCallback& status_callback, 65 // Raw events will be invoked on this callback every
imcheng 2015/12/17 00:18:10 This comment should probably go in CreateParams. A
xjz 2015/12/17 22:54:58 Add comments too in CreateParams. Yes, the code ch
66 const BulkRawEventsCallback& raw_events_callback, 66 // |logging_flush_interval|. If the user is not interested in raw events,
67 base::TimeDelta raw_events_callback_interval, 67 // |logging_flush_interval| should be set to |base::TimeDelta|.
imcheng 2015/12/17 00:18:10 s/base::TimeDelta/base::TimeDelta()
xjz 2015/12/17 22:54:57 Done.
68 const PacketReceiverCallback& packet_callback, 68 virtual void OnReceivedLoggingEvents(
69 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner); 69 scoped_ptr<std::vector<FrameEvent>>,
imcheng 2015/12/17 00:18:10 Add names for the input args.
xjz 2015/12/17 22:54:57 Done.
70 scoped_ptr<std::vector<PacketEvent>>) = 0;
71
72 // Incoming packets that do not match the channels created by
73 // Initialize{Audio,Video} will report to this callback.
74 virtual void OnReceivedPackets(scoped_ptr<Packet> packet) = 0;
75
76 virtual ~Client();
imcheng 2015/12/17 00:18:10 nit: Place the destructor before the other pure vi
xjz 2015/12/17 22:54:57 Done.
77 };
78
79 // Parameters to create a cast transport sender / receiver.
80 // |options| contains optional settings for the transport, possible
81 // keys are:
82 // "DSCP" (value ignored)
83 // - Turns DSCP on (higher IP Precedence and Type of Service).
84 // "disable_non_blocking_io" (value ignored)
85 // - Windows only. Turns off non-blocking IO for the socket.
86 // Note: Non-blocking IO is, by default, enabled on all platforms.
87 // "pacer_target_burst_size": int
88 // - Specifies how many packets to send per 10 ms ideally.
89 // "pacer_max_burst_size": int
90 // - Specifies how many pakcets to send per 10 ms, maximum.
91 // "send_buffer_min_size": int
92 // - Specifies the minimum socket send buffer size.
93 // "disable_wifi_scan" (value ignored)
94 // - Disable wifi scans while streaming.
95 // "media_streaming_mode" (value ignored)
96 // - Turn media streaming mode on.
97 // Note, these options may be ignored on some platforms.
98 struct CreateParams {
99 CreateParams(
imcheng 2015/12/17 00:18:10 I feel some of these arguments do not belong in th
xjz 2015/12/17 22:54:57 There are only three pure data. |options| is also
100 net::NetLog* log,
101 base::TickClock* input_clock,
102 net::IPEndPoint local_addr,
103 net::IPEndPoint remote_addr,
104 scoped_ptr<Client> transport_client,
105 base::TimeDelta transport_logging_flush_interval,
106 scoped_ptr<base::DictionaryValue> options,
107 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
108 ~CreateParams();
109
110 net::NetLog* net_log;
111 base::TickClock* clock;
112 net::IPEndPoint local_end_point;
113 net::IPEndPoint remote_end_point;
114 scoped_ptr<Client> client;
115 base::TimeDelta logging_flush_interval;
116 scoped_ptr<base::DictionaryValue> optional_config;
imcheng 2015/12/17 00:18:10 If this is optional, can it be set via a setter()
xjz 2015/12/17 22:54:57 It is only used inside the constructor. I prefer l
117 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner;
imcheng 2015/12/17 00:18:10 Did you mean scoped_refptr<base::SingleThreadTaskR
xjz 2015/12/17 22:54:57 Done.
118 };
119
120 static scoped_ptr<CastTransportSender> Create(const CreateParams& params);
70 121
71 virtual ~CastTransportSender() {} 122 virtual ~CastTransportSender() {}
72 123
73 // Audio/Video initialization. 124 // Audio/Video initialization.
74 // Encoded frames cannot be transmitted until the relevant initialize method 125 // Encoded frames cannot be transmitted until the relevant initialize method
75 // is called. 126 // is called.
76 virtual void InitializeAudio(const CastTransportRtpConfig& config, 127 virtual void InitializeAudio(const CastTransportRtpConfig& config,
77 const RtcpCastMessageCallback& cast_message_cb, 128 const RtcpCastMessageCallback& cast_message_cb,
78 const RtcpRttCallback& rtt_cb) = 0; 129 const RtcpRttCallback& rtt_cb) = 0;
79 virtual void InitializeVideo(const CastTransportRtpConfig& config, 130 virtual void InitializeVideo(const CastTransportRtpConfig& config,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 const RtcpCastMessage* cast_message, 172 const RtcpCastMessage* cast_message,
122 base::TimeDelta target_delay, 173 base::TimeDelta target_delay,
123 const ReceiverRtcpEventSubscriber::RtcpEvents* rtcp_events, 174 const ReceiverRtcpEventSubscriber::RtcpEvents* rtcp_events,
124 const RtpReceiverStatistics* rtp_receiver_statistics) = 0; 175 const RtpReceiverStatistics* rtp_receiver_statistics) = 0;
125 }; 176 };
126 177
127 } // namespace cast 178 } // namespace cast
128 } // namespace media 179 } // namespace media
129 180
130 #endif // MEDIA_CAST_NET_CAST_TRANSPORT_SENDER_H_ 181 #endif // MEDIA_CAST_NET_CAST_TRANSPORT_SENDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698