OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_CAST_AUDIO_SENDER_H_ | 5 #ifndef MEDIA_CAST_AUDIO_SENDER_H_ |
6 #define MEDIA_CAST_AUDIO_SENDER_H_ | 6 #define MEDIA_CAST_AUDIO_SENDER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/threading/non_thread_safe.h" | 12 #include "base/threading/non_thread_safe.h" |
13 #include "base/time/tick_clock.h" | 13 #include "base/time/tick_clock.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "media/cast/cast_config.h" | 15 #include "media/cast/cast_config.h" |
16 #include "media/cast/cast_environment.h" | 16 #include "media/cast/cast_environment.h" |
17 #include "media/cast/rtcp/rtcp.h" | 17 #include "media/cast/rtcp/rtcp.h" |
18 #include "media/cast/rtp_sender/rtp_sender.h" | 18 #include "media/cast/rtp_sender/rtp_sender.h" |
19 | 19 |
| 20 namespace crypto { |
| 21 class Encryptor; |
| 22 } |
| 23 |
20 namespace media { | 24 namespace media { |
21 class AudioBus; | 25 class AudioBus; |
22 } | 26 } |
23 | 27 |
24 namespace media { | 28 namespace media { |
25 namespace cast { | 29 namespace cast { |
26 | 30 |
27 class AudioEncoder; | 31 class AudioEncoder; |
28 class LocalRtcpAudioSenderFeedback; | 32 class LocalRtcpAudioSenderFeedback; |
29 class LocalRtpSenderStatistics; | 33 class LocalRtpSenderStatistics; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 protected: | 67 protected: |
64 void SendEncodedAudioFrame(scoped_ptr<EncodedAudioFrame> audio_frame, | 68 void SendEncodedAudioFrame(scoped_ptr<EncodedAudioFrame> audio_frame, |
65 const base::TimeTicks& recorded_time); | 69 const base::TimeTicks& recorded_time); |
66 | 70 |
67 private: | 71 private: |
68 friend class LocalRtcpAudioSenderFeedback; | 72 friend class LocalRtcpAudioSenderFeedback; |
69 | 73 |
70 void ResendPackets( | 74 void ResendPackets( |
71 const MissingFramesAndPacketsMap& missing_frames_and_packets); | 75 const MissingFramesAndPacketsMap& missing_frames_and_packets); |
72 | 76 |
| 77 // Caller must allocate the destination |encrypted_frame|. The data member |
| 78 // will be resized to hold the encrypted size. |
| 79 bool EncryptAudioFrame(const EncodedAudioFrame& audio_frame, |
| 80 EncodedAudioFrame* encrypted_frame); |
| 81 |
73 void ScheduleNextRtcpReport(); | 82 void ScheduleNextRtcpReport(); |
74 void SendRtcpReport(); | 83 void SendRtcpReport(); |
75 | 84 |
76 void InitializeTimers(); | 85 void InitializeTimers(); |
77 | 86 |
78 base::WeakPtrFactory<AudioSender> weak_factory_; | 87 base::WeakPtrFactory<AudioSender> weak_factory_; |
79 | 88 |
80 scoped_refptr<CastEnvironment> cast_environment_; | 89 scoped_refptr<CastEnvironment> cast_environment_; |
81 scoped_refptr<AudioEncoder> audio_encoder_; | 90 scoped_refptr<AudioEncoder> audio_encoder_; |
82 RtpSender rtp_sender_; | 91 RtpSender rtp_sender_; |
83 scoped_ptr<LocalRtpSenderStatistics> rtp_audio_sender_statistics_; | 92 scoped_ptr<LocalRtpSenderStatistics> rtp_audio_sender_statistics_; |
84 scoped_ptr<LocalRtcpAudioSenderFeedback> rtcp_feedback_; | 93 scoped_ptr<LocalRtcpAudioSenderFeedback> rtcp_feedback_; |
85 Rtcp rtcp_; | 94 Rtcp rtcp_; |
86 bool initialized_; | 95 bool initialized_; |
| 96 scoped_ptr<crypto::Encryptor> encryptor_; |
| 97 std::string iv_mask_; |
87 | 98 |
88 DISALLOW_COPY_AND_ASSIGN(AudioSender); | 99 DISALLOW_COPY_AND_ASSIGN(AudioSender); |
89 }; | 100 }; |
90 | 101 |
91 } // namespace cast | 102 } // namespace cast |
92 } // namespace media | 103 } // namespace media |
93 | 104 |
94 #endif // MEDIA_CAST_AUDIO_SENDER_H_ | 105 #endif // MEDIA_CAST_AUDIO_SENDER_H_ |
OLD | NEW |