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"
15 #include "media/cast/transport/utility/transport_encryption_handler.h"
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 {
31 const CastTransportConfig& config,
32 base::TickClock* clock,
33 const scoped_refptr<base::TaskRunner>& transport_task_runner,
34 PacedSender* const paced_packet_sender);
36 virtual ~TransportVideoSender();
38 // Handles the encoded video frames to be processed.
39 // Frames will be encrypted, packetized and transmitted to the network.
40 void InsertCodedVideoFrame(const EncodedVideoFrame* coded_frame,
41 const base::TimeTicks& capture_time);
43 // Retransmision request.
45 const MissingFramesAndPacketsMap& missing_frames_and_packets);
47 bool initialized() const { return initialized_; }
49 // Subscribe callback to get RTP Audio stats.
50 void SubscribeVideoRtpStatsCallback(
51 const CastTransportRtpStatistics& callback);
54 // Caller must allocate the destination |encrypted_video_frame| the data
55 // member will be resized to hold the encrypted size.
56 bool EncryptVideoFrame(const EncodedVideoFrame& encoded_frame,
57 EncodedVideoFrame* encrypted_video_frame);
59 const base::TimeDelta rtp_max_delay_;
60 TransportEncryptionHandler encryptor_;
61 RtpSender rtp_sender_;
64 DISALLOW_IMPLICIT_CONSTRUCTORS(TransportVideoSender);
67 } // namespace transport
71 #endif // MEDIA_CAST_TRANSPORT_TRANSPORT_VIDEO_SENDER_H_