| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MEDIA_CAST_TRANSPORT_TRANSPORT_VIDEO_SENDER_H_ | |
| 6 #define MEDIA_CAST_TRANSPORT_TRANSPORT_VIDEO_SENDER_H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
| 9 #include "base/memory/ref_counted.h" | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "base/threading/non_thread_safe.h" | |
| 12 #include "base/time/tick_clock.h" | |
| 13 #include "media/cast/transport/cast_transport_config.h" | |
| 14 #include "media/cast/transport/rtp_sender/rtp_sender.h" | |
| 15 #include "media/cast/transport/utility/transport_encryption_handler.h" | |
| 16 | |
| 17 namespace media { | |
| 18 class VideoFrame; | |
| 19 | |
| 20 namespace cast { | |
| 21 | |
| 22 namespace transport { | |
| 23 class PacedSender; | |
| 24 | |
| 25 // Not thread safe. Only called from the main cast transport thread. | |
| 26 // This class owns all objects related to sending coded video, objects that | |
| 27 // encrypt, create RTP packets and send to network. | |
| 28 class TransportVideoSender : public base::NonThreadSafe { | |
| 29 public: | |
| 30 TransportVideoSender( | |
| 31 const CastTransportVideoConfig& config, | |
| 32 base::TickClock* clock, | |
| 33 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner, | |
| 34 PacedSender* const paced_packet_sender); | |
| 35 | |
| 36 virtual ~TransportVideoSender(); | |
| 37 | |
| 38 // Handles the encoded video frames to be processed. | |
| 39 // Frames will be encrypted, packetized and transmitted to the network. | |
| 40 void SendFrame(const EncodedFrame& video_frame); | |
| 41 | |
| 42 // Retransmision request. | |
| 43 void ResendPackets( | |
| 44 const MissingFramesAndPacketsMap& missing_frames_and_packets); | |
| 45 | |
| 46 size_t send_packet_count() const { return rtp_sender_.send_packet_count(); } | |
| 47 size_t send_octet_count() const { return rtp_sender_.send_octet_count(); } | |
| 48 uint32 ssrc() const { return rtp_sender_.ssrc(); } | |
| 49 bool initialized() const { return initialized_; } | |
| 50 | |
| 51 private: | |
| 52 // Caller must allocate the destination |encrypted_video_frame| the data | |
| 53 // member will be resized to hold the encrypted size. | |
| 54 bool EncryptVideoFrame(const EncodedFrame& encoded_frame, | |
| 55 EncodedFrame* encrypted_video_frame); | |
| 56 | |
| 57 const base::TimeDelta rtp_max_delay_; | |
| 58 TransportEncryptionHandler encryptor_; | |
| 59 RtpSender rtp_sender_; | |
| 60 bool initialized_; | |
| 61 | |
| 62 DISALLOW_IMPLICIT_CONSTRUCTORS(TransportVideoSender); | |
| 63 }; | |
| 64 | |
| 65 } // namespace transport | |
| 66 } // namespace cast | |
| 67 } // namespace media | |
| 68 | |
| 69 #endif // MEDIA_CAST_TRANSPORT_TRANSPORT_VIDEO_SENDER_H_ | |
| OLD | NEW |