| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // 3. Call CastTransportSender::SetPacketReceiver to ensure that the packets | 13 // 3. Call CastTransportSender::SetPacketReceiver to ensure that the packets |
| 14 // received by the CastTransportSender will be sent to the CastSender. | 14 // received by the CastTransportSender will be sent to the CastSender. |
| 15 // Steps 3 can be done interchangeably. | 15 // Steps 3 can be done interchangeably. |
| 16 | 16 |
| 17 // Destruction: The CastTransportSender is assumed to be valid as long as the | 17 // Destruction: The CastTransportSender is assumed to be valid as long as the |
| 18 // CastSender is alive. Therefore the CastSender should be destructed before the | 18 // CastSender is alive. Therefore the CastSender should be destructed before the |
| 19 // CastTransportSender. | 19 // CastTransportSender. |
| 20 // This also works when the CastSender acts as a receiver for the RTCP packets | 20 // This also works when the CastSender acts as a receiver for the RTCP packets |
| 21 // due to the weak pointers in the ReceivedPacket method in cast_sender_impl.cc. | 21 // due to the weak pointers in the ReceivedPacket method in cast_sender_impl.cc. |
| 22 | 22 |
| 23 #ifndef MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_SENDER_H_ | 23 #ifndef MEDIA_CAST_NET_CAST_TRANSPORT_SENDER_H_ |
| 24 #define MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_SENDER_H_ | 24 #define MEDIA_CAST_NET_CAST_TRANSPORT_SENDER_H_ |
| 25 | 25 |
| 26 #include "base/basictypes.h" | 26 #include "base/basictypes.h" |
| 27 #include "base/callback.h" | 27 #include "base/callback.h" |
| 28 #include "base/single_thread_task_runner.h" | 28 #include "base/single_thread_task_runner.h" |
| 29 #include "base/threading/non_thread_safe.h" | 29 #include "base/threading/non_thread_safe.h" |
| 30 #include "base/time/tick_clock.h" | 30 #include "base/time/tick_clock.h" |
| 31 #include "media/cast/logging/logging_defines.h" | 31 #include "media/cast/logging/logging_defines.h" |
| 32 #include "media/cast/transport/cast_transport_config.h" | 32 #include "media/cast/net/cast_transport_config.h" |
| 33 #include "media/cast/transport/cast_transport_defines.h" | 33 #include "media/cast/net/cast_transport_defines.h" |
| 34 | 34 |
| 35 namespace net { | 35 namespace net { |
| 36 class NetLog; | 36 class NetLog; |
| 37 } // namespace net | 37 } // namespace net |
| 38 | 38 |
| 39 namespace media { | 39 namespace media { |
| 40 namespace cast { | 40 namespace cast { |
| 41 namespace transport { | |
| 42 | 41 |
| 43 // Following the initialization of either audio or video an initialization | 42 // Following the initialization of either audio or video an initialization |
| 44 // status will be sent via this callback. | 43 // status will be sent via this callback. |
| 45 typedef base::Callback<void(CastTransportStatus status)> | 44 typedef base::Callback<void(CastTransportStatus status)> |
| 46 CastTransportStatusCallback; | 45 CastTransportStatusCallback; |
| 47 | 46 |
| 48 typedef base::Callback<void(const std::vector<PacketEvent>&)> | 47 typedef base::Callback<void(const std::vector<PacketEvent>&)> |
| 49 BulkRawEventsCallback; | 48 BulkRawEventsCallback; |
| 50 | 49 |
| 51 // The application should only trigger this class from the transport thread. | 50 // The application should only trigger this class from the transport thread. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // |missing_packets|. If the requested packet(s) were sent recently | 97 // |missing_packets|. If the requested packet(s) were sent recently |
| 99 // (how long is specified by |dedupe_window|) then this re-transmit | 98 // (how long is specified by |dedupe_window|) then this re-transmit |
| 100 // will be ignored. | 99 // will be ignored. |
| 101 virtual void ResendPackets( | 100 virtual void ResendPackets( |
| 102 bool is_audio, | 101 bool is_audio, |
| 103 const MissingFramesAndPacketsMap& missing_packets, | 102 const MissingFramesAndPacketsMap& missing_packets, |
| 104 bool cancel_rtx_if_not_in_list, | 103 bool cancel_rtx_if_not_in_list, |
| 105 base::TimeDelta dedupe_window) = 0; | 104 base::TimeDelta dedupe_window) = 0; |
| 106 }; | 105 }; |
| 107 | 106 |
| 108 } // namespace transport | |
| 109 } // namespace cast | 107 } // namespace cast |
| 110 } // namespace media | 108 } // namespace media |
| 111 | 109 |
| 112 #endif // MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_SENDER_H_ | 110 #endif // MEDIA_CAST_NET_CAST_TRANSPORT_SENDER_H_ |
| OLD | NEW |