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.
5 #ifndef MEDIA_CAST_TRANSPORT_TRANSPORT_VIDEO_SENDER_H_
6 #define MEDIA_CAST_TRANSPORT_TRANSPORT_VIDEO_SENDER_H_
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"
29 // Not thread safe. Only called from the main cast transport thread.
30 // This class owns all objects related to sending coded video, objects that
31 // encrypt, create RTP packets and send to network.
32 class TransportVideoSender : public base::NonThreadSafe {
34 TransportVideoSender(const CastTransportConfig& config,
35 base::TickClock* clock,
36 PacedSender* const paced_packet_sender);
38 virtual ~TransportVideoSender();
40 // Handles the encoded video frames to be processed.
41 // Frames will be encrypted, packetized and transmitted to the network.
42 void InsertCodedVideoFrame(const EncodedVideoFrame* coded_frame,
43 const base::TimeTicks& capture_time);
45 // Retrieves video RTP statistics.
46 void GetStatistics(const base::TimeTicks& now, RtcpSenderInfo* sender_info);
48 // Retransmision request.
50 const MissingFramesAndPacketsMap& missing_frames_and_packets);
52 bool initialized() const { return initialized_; }
55 // Caller must allocate the destination |encrypted_video_frame| the data
56 // member will be resized to hold the encrypted size.
57 bool EncryptVideoFrame(const EncodedVideoFrame& encoded_frame,
58 EncodedVideoFrame* encrypted_video_frame);
60 const base::TimeDelta rtp_max_delay_;
62 RtpSender rtp_sender_;
63 scoped_ptr<crypto::SymmetricKey> key_;
64 scoped_ptr<crypto::Encryptor> encryptor_;
69 DISALLOW_IMPLICIT_CONSTRUCTORS(TransportVideoSender);
72 } // namespace transport
76 #endif // MEDIA_CAST_TRANSPORT_TRANSPORT_VIDEO_SENDER_H_