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"
21 // It's only called from the main cast transport thread.
22 class TransportAudioSender : public base::NonThreadSafe {
25 const CastTransportConfig& config,
26 base::TickClock* clock,
27 const scoped_refptr<base::TaskRunner>& transport_task_runner,
28 PacedSender* const paced_packet_sender);
30 virtual ~TransportAudioSender();
32 // Handles the encoded audio frames to be processed.
33 // Frames will be encrypted, packetized and transmitted to the network.
34 void InsertCodedAudioFrame(const EncodedAudioFrame* audio_frame,
35 const base::TimeTicks& recorded_time);
37 // Retransmision request.
39 const MissingFramesAndPacketsMap& missing_frames_and_packets);
41 bool initialized() const { return initialized_; }
43 // Subscribe callback to get RTP Audio stats.
44 void SubscribeAudioRtpStatsCallback(
45 const CastTransportRtpStatistics& callback);
48 friend class LocalRtcpAudioSenderFeedback;
50 // Caller must allocate the destination |encrypted_frame|. The data member
51 // will be resized to hold the encrypted size.
52 bool EncryptAudioFrame(const EncodedAudioFrame& audio_frame,
53 EncodedAudioFrame* encrypted_frame);
55 RtpSender rtp_sender_;
56 TransportEncryptionHandler encryptor_;
59 DISALLOW_IMPLICIT_CONSTRUCTORS(TransportAudioSender);
62 } // namespace transport
66 #endif // MEDIA_CAST_TRANSPORT_TRANSPORT_AUDIO_SENDER_H_