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_AUDIO_SENDER_H_ | |
6 #define MEDIA_CAST_TRANSPORT_TRANSPORT_AUDIO_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 "media/cast/transport/rtp_sender/rtp_sender.h" | |
13 #include "media/cast/transport/utility/transport_encryption_handler.h" | |
14 | |
15 namespace media { | |
16 namespace cast { | |
17 | |
18 namespace transport { | |
19 | |
20 class PacedSender; | |
21 | |
22 // It's only called from the main cast transport thread. | |
23 class TransportAudioSender : public base::NonThreadSafe { | |
24 public: | |
25 TransportAudioSender( | |
26 const CastTransportAudioConfig& config, | |
27 base::TickClock* clock, | |
28 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner, | |
29 PacedSender* const paced_packet_sender); | |
30 | |
31 virtual ~TransportAudioSender(); | |
32 | |
33 // Handles the encoded audio frames to be processed. | |
34 // Frames will be encrypted, packetized and transmitted to the network. | |
35 void SendFrame(const EncodedFrame& audio_frame); | |
36 | |
37 // Retransmision request. | |
38 void ResendPackets( | |
39 const MissingFramesAndPacketsMap& missing_frames_and_packets); | |
40 | |
41 size_t send_packet_count() const { return rtp_sender_.send_packet_count(); } | |
42 size_t send_octet_count() const { return rtp_sender_.send_octet_count(); } | |
43 uint32 ssrc() const { return rtp_sender_.ssrc(); } | |
44 bool initialized() const { return initialized_; } | |
45 | |
46 private: | |
47 friend class LocalRtcpAudioSenderFeedback; | |
48 | |
49 // Caller must allocate the destination |encrypted_frame|. The data member | |
50 // will be resized to hold the encrypted size. | |
51 bool EncryptAudioFrame(const EncodedFrame& audio_frame, | |
52 EncodedFrame* encrypted_frame); | |
53 | |
54 RtpSender rtp_sender_; | |
55 TransportEncryptionHandler encryptor_; | |
56 bool initialized_; | |
57 | |
58 DISALLOW_IMPLICIT_CONSTRUCTORS(TransportAudioSender); | |
59 }; | |
60 | |
61 } // namespace transport | |
62 } // namespace cast | |
63 } // namespace media | |
64 | |
65 #endif // MEDIA_CAST_TRANSPORT_TRANSPORT_AUDIO_SENDER_H_ | |
OLD | NEW |