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_AUDIO_SENDER_H_
6 #define MEDIA_CAST_TRANSPORT_TRANSPORT_AUDIO_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 "media/cast/transport/rtp_sender/rtp_sender.h"
13 #include "media/cast/transport/utility/transport_encryption_handler.h"
22 // It's only called from the main cast transport thread.
23 class TransportAudioSender : public base::NonThreadSafe {
26 const CastTransportAudioConfig& config,
27 base::TickClock* clock,
28 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner,
29 PacedSender* const paced_packet_sender);
31 virtual ~TransportAudioSender();
33 // Handles the encoded audio frames to be processed.
34 // Frames will be encrypted, packetized and transmitted to the network.
35 void InsertCodedAudioFrame(const EncodedAudioFrame* audio_frame,
36 const base::TimeTicks& recorded_time);
38 // Retransmision request.
40 const MissingFramesAndPacketsMap& missing_frames_and_packets);
42 bool initialized() const { return initialized_; }
44 // Subscribe callback to get RTP Audio stats.
45 void SubscribeAudioRtpStatsCallback(
46 const CastTransportRtpStatistics& callback);
49 friend class LocalRtcpAudioSenderFeedback;
51 // Caller must allocate the destination |encrypted_frame|. The data member
52 // will be resized to hold the encrypted size.
53 bool EncryptAudioFrame(const EncodedAudioFrame& audio_frame,
54 EncodedAudioFrame* encrypted_frame);
56 RtpSender rtp_sender_;
57 TransportEncryptionHandler encryptor_;
60 DISALLOW_IMPLICIT_CONSTRUCTORS(TransportAudioSender);
63 } // namespace transport
67 #endif // MEDIA_CAST_TRANSPORT_TRANSPORT_AUDIO_SENDER_H_