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

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

Issue 765643006: Cast: Make receiver use cast_transport (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix end2end test Created 6 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 22 matching lines...) Expand all
33 namespace base { 33 namespace base {
34 class DictionaryValue; 34 class DictionaryValue;
35 } // namespace base 35 } // namespace base
36 36
37 namespace net { 37 namespace net {
38 class NetLog; 38 class NetLog;
39 } // namespace net 39 } // namespace net
40 40
41 namespace media { 41 namespace media {
42 namespace cast { 42 namespace cast {
43 struct RtpReceiverStatistics;
44 struct RtcpTimeData;
43 45
44 // Following the initialization of either audio or video an initialization 46 // Following the initialization of either audio or video an initialization
45 // status will be sent via this callback. 47 // status will be sent via this callback.
46 typedef base::Callback<void(CastTransportStatus status)> 48 typedef base::Callback<void(CastTransportStatus status)>
47 CastTransportStatusCallback; 49 CastTransportStatusCallback;
48 50
49 typedef base::Callback<void(const std::vector<PacketEvent>&, 51 typedef base::Callback<void(const std::vector<PacketEvent>&,
50 const std::vector<FrameEvent>&)> 52 const std::vector<FrameEvent>&)>
51 BulkRawEventsCallback; 53 BulkRawEventsCallback;
52 54
53 // The application should only trigger this class from the transport thread. 55 // The application should only trigger this class from the transport thread.
54 class CastTransportSender : public base::NonThreadSafe { 56 class CastTransportSender : public base::NonThreadSafe {
55 public: 57 public:
56 static scoped_ptr<CastTransportSender> Create( 58 static scoped_ptr<CastTransportSender> Create(
57 net::NetLog* net_log, 59 net::NetLog* net_log,
58 base::TickClock* clock, 60 base::TickClock* clock,
61 const net::IPEndPoint& local_end_point,
59 const net::IPEndPoint& remote_end_point, 62 const net::IPEndPoint& remote_end_point,
60 scoped_ptr<base::DictionaryValue> options, 63 scoped_ptr<base::DictionaryValue> options,
61 const CastTransportStatusCallback& status_callback, 64 const CastTransportStatusCallback& status_callback,
62 const BulkRawEventsCallback& raw_events_callback, 65 const BulkRawEventsCallback& raw_events_callback,
63 base::TimeDelta raw_events_callback_interval, 66 base::TimeDelta raw_events_callback_interval,
67 const PacketReceiverCallback& packet_callback,
64 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner); 68 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner);
65 69
66 virtual ~CastTransportSender() {} 70 virtual ~CastTransportSender() {}
67 71
68 // Audio/Video initialization. 72 // Audio/Video initialization.
69 // Encoded frames cannot be transmitted until the relevant initialize method 73 // Encoded frames cannot be transmitted until the relevant initialize method
70 // is called. 74 // is called.
71 virtual void InitializeAudio(const CastTransportRtpConfig& config, 75 virtual void InitializeAudio(const CastTransportRtpConfig& config,
72 const RtcpCastMessageCallback& cast_message_cb, 76 const RtcpCastMessageCallback& cast_message_cb,
73 const RtcpRttCallback& rtt_cb) = 0; 77 const RtcpRttCallback& rtt_cb) = 0;
(...skipping 19 matching lines...) Expand all
93 // |frame_ids| contains the IDs of the frames that will be cancelled. 97 // |frame_ids| contains the IDs of the frames that will be cancelled.
94 virtual void CancelSendingFrames(uint32 ssrc, 98 virtual void CancelSendingFrames(uint32 ssrc,
95 const std::vector<uint32>& frame_ids) = 0; 99 const std::vector<uint32>& frame_ids) = 0;
96 100
97 // Resends a frame or part of a frame to kickstart. This is used when the 101 // Resends a frame or part of a frame to kickstart. This is used when the
98 // stream appears to be stalled. 102 // stream appears to be stalled.
99 virtual void ResendFrameForKickstart(uint32 ssrc, uint32 frame_id) = 0; 103 virtual void ResendFrameForKickstart(uint32 ssrc, uint32 frame_id) = 0;
100 104
101 // Returns a callback for receiving packets for testing purposes. 105 // Returns a callback for receiving packets for testing purposes.
102 virtual PacketReceiverCallback PacketReceiverForTesting(); 106 virtual PacketReceiverCallback PacketReceiverForTesting();
107
108 // The following functions are needed for receving.
109
110 // Add a valid SSRC. This is used to verify that incoming packets
111 // come from the right sender. Without valid SSRCs, the return address cannot
112 // be automatically established.
113 virtual void AddValidSsrc(uint32 ssrc) = 0;
114
115 // Send an RTCP message from receiver to sender.
116 virtual void SendRtcpFromRtpReceiver(
117 uint32 ssrc,
118 uint32 sender_ssrc,
119 const RtcpTimeData& time_data,
120 const RtcpCastMessage* cast_message,
121 base::TimeDelta target_delay,
122 const ReceiverRtcpEventSubscriber::RtcpEvents* rtcp_events,
123 const RtpReceiverStatistics* rtp_receiver_statistics) = 0;
103 }; 124 };
104 125
105 } // namespace cast 126 } // namespace cast
106 } // namespace media 127 } // namespace media
107 128
108 #endif // MEDIA_CAST_NET_CAST_TRANSPORT_SENDER_H_ 129 #endif // MEDIA_CAST_NET_CAST_TRANSPORT_SENDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698