OLD | NEW |
---|---|
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 should be done | 9 // Construction of the Cast Sender and the Cast Transport should be done |
10 // in the following order: | 10 // in the following order: |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 // The application should only trigger this class from the transport thread. | 78 // The application should only trigger this class from the transport thread. |
79 class CastTransport : public base::NonThreadSafe { | 79 class CastTransport : public base::NonThreadSafe { |
80 public: | 80 public: |
81 // Interface used for receiving status updates, raw events, and RTP packets | 81 // Interface used for receiving status updates, raw events, and RTP packets |
82 // from CastTransport. | 82 // from CastTransport. |
83 class Client { | 83 class Client { |
84 public: | 84 public: |
85 virtual ~Client(){}; | 85 virtual ~Client(){}; |
86 | 86 |
87 // Audio and Video transport status change is reported on this callback. | 87 // Audio and Video transport status change is reported on this callback. |
88 virtual void OnStatusChanged(CastTransportStatus status) = 0; | 88 virtual void OnStatusChanged(CastTransportStatus status) = 0; |
miu
2016/07/14 22:00:41
Just noticed this: I think you need to add a "ssrc
xjz
2016/07/14 22:43:39
It makes sense to add a "ssrc" argument for TRANSP
| |
89 | 89 |
90 // Raw events will be invoked on this callback periodically, according to | 90 // Raw events will be invoked on this callback periodically, according to |
91 // the configured logging flush interval passed to | 91 // the configured logging flush interval passed to |
92 // CastTransport::Create(). | 92 // CastTransport::Create(). |
93 virtual void OnLoggingEventsReceived( | 93 virtual void OnLoggingEventsReceived( |
94 std::unique_ptr<std::vector<FrameEvent>> frame_events, | 94 std::unique_ptr<std::vector<FrameEvent>> frame_events, |
95 std::unique_ptr<std::vector<PacketEvent>> packet_events) = 0; | 95 std::unique_ptr<std::vector<PacketEvent>> packet_events) = 0; |
96 | 96 |
97 // Called to pass RTP packets to the Client. | 97 // Called to pass RTP packets to the Client. |
98 virtual void ProcessRtpPacket(std::unique_ptr<Packet> packet) = 0; | 98 virtual void ProcessRtpPacket(std::unique_ptr<Packet> packet) = 0; |
99 }; | 99 }; |
100 | 100 |
101 static std::unique_ptr<CastTransport> Create( | 101 static std::unique_ptr<CastTransport> Create( |
102 base::TickClock* clock, // Owned by the caller. | 102 base::TickClock* clock, // Owned by the caller. |
103 base::TimeDelta logging_flush_interval, | 103 base::TimeDelta logging_flush_interval, |
104 std::unique_ptr<Client> client, | 104 std::unique_ptr<Client> client, |
105 std::unique_ptr<PacketTransport> transport, | 105 std::unique_ptr<PacketTransport> transport, |
106 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner); | 106 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner); |
107 | 107 |
108 virtual ~CastTransport() {} | 108 virtual ~CastTransport() {} |
109 | 109 |
110 // Audio/Video initialization. | 110 // Audio/Video initialization. |
111 // Encoded frames cannot be transmitted until the relevant initialize method | 111 // Encoded frames cannot be transmitted until the relevant initialize method |
112 // is called. | 112 // is called. |
113 virtual void InitializeAudio(const CastTransportRtpConfig& config, | 113 virtual void InitializeStream(const CastTransportRtpConfig& config, |
114 std::unique_ptr<RtcpObserver> rtcp_observer) {} | 114 std::unique_ptr<RtcpObserver> rtcp_observer) {} |
115 virtual void InitializeVideo(const CastTransportRtpConfig& config, | |
116 std::unique_ptr<RtcpObserver> rtcp_observer) {} | |
117 | 115 |
118 // Encrypt, packetize and transmit |frame|. |ssrc| must refer to a | 116 // Encrypt, packetize and transmit |frame|. |ssrc| must refer to a |
119 // a channel already established with InitializeAudio / InitializeVideo. | 117 // a channel already established with InitializeAudio / InitializeVideo. |
120 virtual void InsertFrame(uint32_t ssrc, const EncodedFrame& frame) = 0; | 118 virtual void InsertFrame(uint32_t ssrc, const EncodedFrame& frame) = 0; |
121 | 119 |
122 // Sends a RTCP sender report to the receiver. | 120 // Sends a RTCP sender report to the receiver. |
123 // |ssrc| is the SSRC for this report. | 121 // |ssrc| is the SSRC for this report. |
124 // |current_time| is the current time reported by a tick clock. | 122 // |current_time| is the current time reported by a tick clock. |
125 // |current_time_as_rtp_timestamp| is the corresponding RTP timestamp. | 123 // |current_time_as_rtp_timestamp| is the corresponding RTP timestamp. |
126 virtual void SendSenderReport(uint32_t ssrc, | 124 virtual void SendSenderReport(uint32_t ssrc, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 virtual void SendRtcpFromRtpReceiver() = 0; | 168 virtual void SendRtcpFromRtpReceiver() = 0; |
171 | 169 |
172 // Set options for the PacedSender and Wifi. | 170 // Set options for the PacedSender and Wifi. |
173 virtual void SetOptions(const base::DictionaryValue& options) = 0; | 171 virtual void SetOptions(const base::DictionaryValue& options) = 0; |
174 }; | 172 }; |
175 | 173 |
176 } // namespace cast | 174 } // namespace cast |
177 } // namespace media | 175 } // namespace media |
178 | 176 |
179 #endif // MEDIA_CAST_NET_CAST_TRANSPORT_H_ | 177 #endif // MEDIA_CAST_NET_CAST_TRANSPORT_H_ |
OLD | NEW |