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

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
« no previous file with comments | « no previous file | media/cast/net/cast_transport_sender_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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:
11 // 1. Create CastTransportSender. 11 // 1. Create CastTransportSender.
12 // 2. Create CastSender (accepts CastTransportSender as an input). 12 // 2. Create CastSender (accepts CastTransportSender as an input).
13 13
14 // Destruction: The CastTransportSender is assumed to be valid as long as the 14 // Destruction: The CastTransportSender is assumed to be valid as long as the
15 // CastSender is alive. Therefore the CastSender should be destructed before the 15 // CastSender is alive. Therefore the CastSender should be destructed before the
16 // CastTransportSender. 16 // CastTransportSender.
17 17
18 #ifndef MEDIA_CAST_NET_CAST_TRANSPORT_SENDER_H_ 18 #ifndef MEDIA_CAST_NET_CAST_TRANSPORT_SENDER_H_
19 #define MEDIA_CAST_NET_CAST_TRANSPORT_SENDER_H_ 19 #define MEDIA_CAST_NET_CAST_TRANSPORT_SENDER_H_
20 20
21 #include "base/basictypes.h" 21 #include "base/basictypes.h"
22 #include "base/callback.h" 22 #include "base/callback.h"
23 #include "base/memory/scoped_ptr.h" 23 #include "base/memory/scoped_ptr.h"
24 #include "base/memory/weak_ptr.h"
24 #include "base/single_thread_task_runner.h" 25 #include "base/single_thread_task_runner.h"
25 #include "base/threading/non_thread_safe.h" 26 #include "base/threading/non_thread_safe.h"
26 #include "base/time/tick_clock.h" 27 #include "base/time/tick_clock.h"
27 #include "media/cast/logging/logging_defines.h" 28 #include "media/cast/logging/logging_defines.h"
28 #include "media/cast/net/cast_transport_config.h" 29 #include "media/cast/net/cast_transport_config.h"
29 #include "media/cast/net/cast_transport_defines.h" 30 #include "media/cast/net/cast_transport_defines.h"
30 #include "media/cast/net/rtcp/receiver_rtcp_event_subscriber.h" 31 #include "media/cast/net/rtcp/receiver_rtcp_event_subscriber.h"
31 #include "media/cast/net/rtcp/rtcp_defines.h" 32 #include "media/cast/net/rtcp/rtcp_defines.h"
32 #include "net/base/ip_endpoint.h" 33 #include "net/base/ip_endpoint.h"
33 34
(...skipping 12 matching lines...) Expand all
46 47
47 // Following the initialization of either audio or video an initialization 48 // Following the initialization of either audio or video an initialization
48 // status will be sent via this callback. 49 // status will be sent via this callback.
49 typedef base::Callback<void(CastTransportStatus status)> 50 typedef base::Callback<void(CastTransportStatus status)>
50 CastTransportStatusCallback; 51 CastTransportStatusCallback;
51 52
52 typedef base::Callback<void(scoped_ptr<std::vector<FrameEvent>>, 53 typedef base::Callback<void(scoped_ptr<std::vector<FrameEvent>>,
53 scoped_ptr<std::vector<PacketEvent>>)> 54 scoped_ptr<std::vector<PacketEvent>>)>
54 BulkRawEventsCallback; 55 BulkRawEventsCallback;
55 56
57 class CastTransportSenderInfo {
58 public:
59 CastTransportSenderInfo(){};
60
61 virtual void NotifyStatus(CastTransportStatus status) = 0;
62 virtual void SendRawEvents(scoped_ptr<std::vector<FrameEvent>>,
63 scoped_ptr<std::vector<PacketEvent>>) = 0;
64 // Return true if the callback is provided and false otherwise.
65 virtual bool RecievedPackets(scoped_ptr<Packet> packet) = 0;
66 virtual net::NetLog* GetNetLog() = 0;
67 virtual net::IPEndPoint GetLocalEndPoint() = 0;
68 virtual net::IPEndPoint GetRemoteEndPoint() = 0;
69 // Return base::TimeDelta() if no raw events callback is provided.
70 virtual base::TimeDelta GetRawEventsCallBackInterval() = 0;
71 virtual scoped_ptr<base::DictionaryValue> GetOptions() = 0;
72 };
73
56 // The application should only trigger this class from the transport thread. 74 // The application should only trigger this class from the transport thread.
57 class CastTransportSender : public base::NonThreadSafe { 75 class CastTransportSender : public base::NonThreadSafe {
58 public: 76 public:
59 static scoped_ptr<CastTransportSender> Create( 77 static scoped_ptr<CastTransportSender> Create(
60 net::NetLog* net_log, 78 base::WeakPtr<CastTransportSenderInfo> cast_transport_sender_info,
61 base::TickClock* clock, 79 base::TickClock* clock,
Irfan 2015/12/11 18:56:04 Perhaps the UDP transport fields can be combined (
miu 2015/12/12 01:30:45 Agreed. Thinking about this, a structure I'd prop
xjz 2015/12/15 18:40:13 Thanks, Yuri! I'll take your suggestion.
62 const net::IPEndPoint& local_end_point,
63 const net::IPEndPoint& remote_end_point,
64 scoped_ptr<base::DictionaryValue> options,
65 const CastTransportStatusCallback& status_callback,
66 const BulkRawEventsCallback& raw_events_callback,
Irfan 2015/12/11 17:33:25 my feeling here is that only the callbacks should
xjz 2015/12/15 18:40:13 Yuri suggested this too. Changed.
67 base::TimeDelta raw_events_callback_interval,
68 const PacketReceiverCallback& packet_callback,
69 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner); 80 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner);
70 81
71 virtual ~CastTransportSender() {} 82 virtual ~CastTransportSender() {}
72 83
73 // Audio/Video initialization. 84 // Audio/Video initialization.
74 // Encoded frames cannot be transmitted until the relevant initialize method 85 // Encoded frames cannot be transmitted until the relevant initialize method
75 // is called. 86 // is called.
76 virtual void InitializeAudio(const CastTransportRtpConfig& config, 87 virtual void InitializeAudio(const CastTransportRtpConfig& config,
77 const RtcpCastMessageCallback& cast_message_cb, 88 const RtcpCastMessageCallback& cast_message_cb,
78 const RtcpRttCallback& rtt_cb) = 0; 89 const RtcpRttCallback& rtt_cb) = 0;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 const RtcpCastMessage* cast_message, 132 const RtcpCastMessage* cast_message,
122 base::TimeDelta target_delay, 133 base::TimeDelta target_delay,
123 const ReceiverRtcpEventSubscriber::RtcpEvents* rtcp_events, 134 const ReceiverRtcpEventSubscriber::RtcpEvents* rtcp_events,
124 const RtpReceiverStatistics* rtp_receiver_statistics) = 0; 135 const RtpReceiverStatistics* rtp_receiver_statistics) = 0;
125 }; 136 };
126 137
127 } // namespace cast 138 } // namespace cast
128 } // namespace media 139 } // namespace media
129 140
130 #endif // MEDIA_CAST_NET_CAST_TRANSPORT_SENDER_H_ 141 #endif // MEDIA_CAST_NET_CAST_TRANSPORT_SENDER_H_
OLDNEW
« no previous file with comments | « no previous file | media/cast/net/cast_transport_sender_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698