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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: media/cast/net/cast_transport_sender.h
diff --git a/media/cast/net/cast_transport_sender.h b/media/cast/net/cast_transport_sender.h
index 0ff76e111e93b20d1ac41217f9d5373f4146499d..f685588acc709050cc1325e6762f26e88a02fd1e 100644
--- a/media/cast/net/cast_transport_sender.h
+++ b/media/cast/net/cast_transport_sender.h
@@ -57,16 +57,64 @@ typedef base::Callback<void(scoped_ptr<std::vector<FrameEvent>>,
// The application should only trigger this class from the transport thread.
class CastTransportSender : public base::NonThreadSafe {
public:
+ // 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.
+ // incomming packets from CastTransportSender.
+ class Client {
+ public:
+ virtual ~Client(){};
+ // Audio and Video transport status change is reported on this callback.
+ virtual void OnStatusChanged(CastTransportStatus status) = 0;
+
+ // Raw events will be invoked on this callback every
+ // |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.
+ virtual void OnLoggingEventsReceived(
+ scoped_ptr<std::vector<FrameEvent>> frame_events,
+ scoped_ptr<std::vector<PacketEvent>> packet_events) = 0;
+
+ // Incoming packets that do not match the channels created by
+ // Initialize{Audio,Video} will report to this callback.
+ 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().
+ };
+
+ // Parameters used to create udp transport.
+ struct UdpTransportParams {
+ UdpTransportParams(net::NetLog* log, // Owned by the caller.
+ net::IPEndPoint local_addr,
+ net::IPEndPoint remote_addr)
+ : net_log(log),
+ local_end_point(local_addr),
+ remote_end_point(remote_addr) {}
+
+ net::NetLog* net_log;
+ net::IPEndPoint local_end_point;
+ net::IPEndPoint remote_end_point;
+ };
+
+ // Parameters to create a cast transport sender / receiver.
+ // |options| contains optional settings for the transport, possible
+ // keys are:
+ // "DSCP" (value ignored)
+ // - Turns DSCP on (higher IP Precedence and Type of Service).
+ // "disable_non_blocking_io" (value ignored)
+ // - Windows only. Turns off non-blocking IO for the socket.
+ // Note: Non-blocking IO is, by default, enabled on all platforms.
+ // "pacer_target_burst_size": int
+ // - Specifies how many packets to send per 10 ms ideally.
+ // "pacer_max_burst_size": int
+ // - Specifies how many pakcets to send per 10 ms, maximum.
+ // "send_buffer_min_size": int
+ // - Specifies the minimum socket send buffer size.
+ // "disable_wifi_scan" (value ignored)
+ // - Disable wifi scans while streaming.
+ // "media_streaming_mode" (value ignored)
+ // - Turn media streaming mode on.
+ // Note, these options may be ignored on some platforms.
static scoped_ptr<CastTransportSender> Create(
- net::NetLog* net_log,
- base::TickClock* clock,
- const net::IPEndPoint& local_end_point,
- const net::IPEndPoint& remote_end_point,
+ base::TickClock* clock, // Owned by the caller.
+ const UdpTransportParams& upd_transport_params,
+ base::TimeDelta logging_flush_interval,
scoped_ptr<base::DictionaryValue> options,
- const CastTransportStatusCallback& status_callback,
- const BulkRawEventsCallback& raw_events_callback,
- base::TimeDelta raw_events_callback_interval,
- const PacketReceiverCallback& packet_callback,
+ scoped_ptr<Client> client,
const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner);
virtual ~CastTransportSender() {}

Powered by Google App Engine
This is Rietveld 408576698