| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 } // namespace net | 43 } // namespace net |
| 44 | 44 |
| 45 namespace media { | 45 namespace media { |
| 46 namespace cast { | 46 namespace cast { |
| 47 | 47 |
| 48 struct RtpReceiverStatistics; | 48 struct RtpReceiverStatistics; |
| 49 struct RtcpTimeData; | 49 struct RtcpTimeData; |
| 50 | 50 |
| 51 // Following the initialization of either audio or video an initialization | 51 // Following the initialization of either audio or video an initialization |
| 52 // status will be sent via this callback. | 52 // status will be sent via this callback. |
| 53 typedef base::Callback<void(CastTransportStatus status)> | 53 using CastTransportStatusCallback = |
| 54 CastTransportStatusCallback; | 54 base::Callback<void(CastTransportStatus status)>; |
| 55 | 55 |
| 56 typedef base::Callback<void(std::unique_ptr<std::vector<FrameEvent>>, | 56 using BulkRawEventsCallback = |
| 57 std::unique_ptr<std::vector<PacketEvent>>)> | 57 base::Callback<void(std::unique_ptr<std::vector<FrameEvent>>, |
| 58 BulkRawEventsCallback; | 58 std::unique_ptr<std::vector<PacketEvent>>)>; |
| 59 |
| 60 // Interface to handle received RTCP messages on RTP sender. |
| 61 class RtcpObserver { |
| 62 public: |
| 63 virtual ~RtcpObserver() {} |
| 64 |
| 65 // Called on receiving cast message from RTP receiver. |
| 66 virtual void OnReceivedCastMessage(const RtcpCastMessage& cast_message) = 0; |
| 67 |
| 68 // Called on receiving Rtt message from RTP receiver. |
| 69 virtual void OnReceivedRtt(base::TimeDelta round_trip_time) = 0; |
| 70 |
| 71 // Called on receiving PLI from RTP receiver. |
| 72 virtual void OnReceivedPli() = 0; |
| 73 |
| 74 // Called on receiving RTP receiver logs. |
| 75 virtual void OnReceivedReceiverLog(const RtcpReceiverLogMessage& log) {} |
| 76 }; |
| 59 | 77 |
| 60 // The application should only trigger this class from the transport thread. | 78 // The application should only trigger this class from the transport thread. |
| 61 class CastTransport : public base::NonThreadSafe { | 79 class CastTransport : public base::NonThreadSafe { |
| 62 public: | 80 public: |
| 63 // Interface used for receiving status updates, raw events, and RTP packets | 81 // Interface used for receiving status updates, raw events, and RTP packets |
| 64 // from CastTransport. | 82 // from CastTransport. |
| 65 class Client { | 83 class Client { |
| 66 public: | 84 public: |
| 67 virtual ~Client(){}; | 85 virtual ~Client(){}; |
| 68 | 86 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 86 std::unique_ptr<Client> client, | 104 std::unique_ptr<Client> client, |
| 87 std::unique_ptr<PacketTransport> transport, | 105 std::unique_ptr<PacketTransport> transport, |
| 88 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner); | 106 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner); |
| 89 | 107 |
| 90 virtual ~CastTransport() {} | 108 virtual ~CastTransport() {} |
| 91 | 109 |
| 92 // Audio/Video initialization. | 110 // Audio/Video initialization. |
| 93 // Encoded frames cannot be transmitted until the relevant initialize method | 111 // Encoded frames cannot be transmitted until the relevant initialize method |
| 94 // is called. | 112 // is called. |
| 95 virtual void InitializeAudio(const CastTransportRtpConfig& config, | 113 virtual void InitializeAudio(const CastTransportRtpConfig& config, |
| 96 const RtcpCastMessageCallback& cast_message_cb, | 114 std::unique_ptr<RtcpObserver> rtcp_observer) {} |
| 97 const RtcpRttCallback& rtt_cb, | |
| 98 const RtcpPliCallback& pli_cb) = 0; | |
| 99 virtual void InitializeVideo(const CastTransportRtpConfig& config, | 115 virtual void InitializeVideo(const CastTransportRtpConfig& config, |
| 100 const RtcpCastMessageCallback& cast_message_cb, | 116 std::unique_ptr<RtcpObserver> rtcp_observer) {} |
| 101 const RtcpRttCallback& rtt_cb, | |
| 102 const RtcpPliCallback& pli_cb) = 0; | |
| 103 | 117 |
| 104 // Encrypt, packetize and transmit |frame|. |ssrc| must refer to a | 118 // Encrypt, packetize and transmit |frame|. |ssrc| must refer to a |
| 105 // a channel already established with InitializeAudio / InitializeVideo. | 119 // a channel already established with InitializeAudio / InitializeVideo. |
| 106 virtual void InsertFrame(uint32_t ssrc, const EncodedFrame& frame) = 0; | 120 virtual void InsertFrame(uint32_t ssrc, const EncodedFrame& frame) = 0; |
| 107 | 121 |
| 108 // Sends a RTCP sender report to the receiver. | 122 // Sends a RTCP sender report to the receiver. |
| 109 // |ssrc| is the SSRC for this report. | 123 // |ssrc| is the SSRC for this report. |
| 110 // |current_time| is the current time reported by a tick clock. | 124 // |current_time| is the current time reported by a tick clock. |
| 111 // |current_time_as_rtp_timestamp| is the corresponding RTP timestamp. | 125 // |current_time_as_rtp_timestamp| is the corresponding RTP timestamp. |
| 112 virtual void SendSenderReport(uint32_t ssrc, | 126 virtual void SendSenderReport(uint32_t ssrc, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 virtual void SendRtcpFromRtpReceiver() = 0; | 170 virtual void SendRtcpFromRtpReceiver() = 0; |
| 157 | 171 |
| 158 // Set options for the PacedSender and Wifi. | 172 // Set options for the PacedSender and Wifi. |
| 159 virtual void SetOptions(const base::DictionaryValue& options) = 0; | 173 virtual void SetOptions(const base::DictionaryValue& options) = 0; |
| 160 }; | 174 }; |
| 161 | 175 |
| 162 } // namespace cast | 176 } // namespace cast |
| 163 } // namespace media | 177 } // namespace media |
| 164 | 178 |
| 165 #endif // MEDIA_CAST_NET_CAST_TRANSPORT_H_ | 179 #endif // MEDIA_CAST_NET_CAST_TRANSPORT_H_ |
| OLD | NEW |