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_RECEIVER_AUDIO_RECEIVER_H_ | 5 #ifndef MEDIA_CAST_AUDIO_RECEIVER_AUDIO_RECEIVER_H_ |
6 #define MEDIA_CAST_AUDIO_RECEIVER_AUDIO_RECEIVER_H_ | 6 #define MEDIA_CAST_AUDIO_RECEIVER_AUDIO_RECEIVER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/threading/non_thread_safe.h" | 13 #include "base/threading/non_thread_safe.h" |
14 #include "base/time/tick_clock.h" | 14 #include "base/time/tick_clock.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "media/cast/cast_config.h" | 16 #include "media/cast/cast_config.h" |
17 #include "media/cast/cast_environment.h" | 17 #include "media/cast/cast_environment.h" |
18 #include "media/cast/cast_receiver.h" | 18 #include "media/cast/cast_receiver.h" |
19 #include "media/cast/rtcp/rtcp.h" // RtcpCastMessage | 19 #include "media/cast/rtcp/rtcp.h" // RtcpCastMessage |
20 #include "media/cast/rtp_common/rtp_defines.h" // RtpCastHeader | 20 #include "media/cast/rtp_common/rtp_defines.h" // RtpCastHeader |
21 | 21 |
| 22 namespace crypto { |
| 23 class Encryptor; |
| 24 } |
| 25 |
22 namespace media { | 26 namespace media { |
23 namespace cast { | 27 namespace cast { |
24 | 28 |
25 class AudioDecoder; | 29 class AudioDecoder; |
26 class Framer; | 30 class Framer; |
27 class LocalRtpAudioData; | 31 class LocalRtpAudioData; |
28 class LocalRtpAudioFeedback; | 32 class LocalRtpAudioFeedback; |
29 class PacedPacketSender; | 33 class PacedPacketSender; |
30 class RtpReceiver; | 34 class RtpReceiver; |
31 class RtpReceiverStatistics; | 35 class RtpReceiverStatistics; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // thread. | 80 // thread. |
77 void DecodeAudioFrameThread(int number_of_10ms_blocks, | 81 void DecodeAudioFrameThread(int number_of_10ms_blocks, |
78 int desired_frequency, | 82 int desired_frequency, |
79 const AudioFrameDecodedCallback callback); | 83 const AudioFrameDecodedCallback callback); |
80 | 84 |
81 // Return the playout time based on the current time and rtp timestamp. | 85 // Return the playout time based on the current time and rtp timestamp. |
82 base::TimeTicks GetPlayoutTime(base::TimeTicks now, uint32 rtp_timestamp); | 86 base::TimeTicks GetPlayoutTime(base::TimeTicks now, uint32 rtp_timestamp); |
83 | 87 |
84 void InitializeTimers(); | 88 void InitializeTimers(); |
85 | 89 |
| 90 // Decrypts the data within the |audio_frame| and replaces the data with the |
| 91 // decrypted string. |
| 92 bool DecryptAudioFrame(scoped_ptr<EncodedAudioFrame>* audio_frame); |
| 93 |
86 // Schedule the next RTCP report. | 94 // Schedule the next RTCP report. |
87 void ScheduleNextRtcpReport(); | 95 void ScheduleNextRtcpReport(); |
88 | 96 |
89 // Actually send the next RTCP report. | 97 // Actually send the next RTCP report. |
90 void SendNextRtcpReport(); | 98 void SendNextRtcpReport(); |
91 | 99 |
92 // Schedule timing for the next cast message. | 100 // Schedule timing for the next cast message. |
93 void ScheduleNextCastMessage(); | 101 void ScheduleNextCastMessage(); |
94 | 102 |
95 // Actually send the next cast message. | 103 // Actually send the next cast message. |
96 void SendNextCastMessage(); | 104 void SendNextCastMessage(); |
97 | 105 |
98 scoped_refptr<CastEnvironment> cast_environment_; | 106 scoped_refptr<CastEnvironment> cast_environment_; |
99 base::WeakPtrFactory<AudioReceiver> weak_factory_; | 107 base::WeakPtrFactory<AudioReceiver> weak_factory_; |
100 | 108 |
101 const AudioCodec codec_; | 109 const AudioCodec codec_; |
102 const int frequency_; | 110 const int frequency_; |
103 base::TimeDelta target_delay_delta_; | 111 base::TimeDelta target_delay_delta_; |
104 scoped_ptr<Framer> audio_buffer_; | 112 scoped_ptr<Framer> audio_buffer_; |
105 scoped_refptr<AudioDecoder> audio_decoder_; | 113 scoped_refptr<AudioDecoder> audio_decoder_; |
106 scoped_ptr<LocalRtpAudioData> incoming_payload_callback_; | 114 scoped_ptr<LocalRtpAudioData> incoming_payload_callback_; |
107 scoped_ptr<LocalRtpAudioFeedback> incoming_payload_feedback_; | 115 scoped_ptr<LocalRtpAudioFeedback> incoming_payload_feedback_; |
108 scoped_ptr<RtpReceiver> rtp_receiver_; | 116 scoped_ptr<RtpReceiver> rtp_receiver_; |
109 scoped_ptr<Rtcp> rtcp_; | 117 scoped_ptr<Rtcp> rtcp_; |
110 scoped_ptr<RtpReceiverStatistics> rtp_audio_receiver_statistics_; | 118 scoped_ptr<RtpReceiverStatistics> rtp_audio_receiver_statistics_; |
111 base::TimeDelta time_offset_; | 119 base::TimeDelta time_offset_; |
112 base::TimeTicks time_first_incoming_packet_; | 120 base::TimeTicks time_first_incoming_packet_; |
113 uint32 first_incoming_rtp_timestamp_; | 121 uint32 first_incoming_rtp_timestamp_; |
| 122 scoped_ptr<crypto::Encryptor> decryptor_; |
| 123 std::string iv_mask_; |
114 | 124 |
115 std::list<AudioFrameEncodedCallback> queued_encoded_callbacks_; | 125 std::list<AudioFrameEncodedCallback> queued_encoded_callbacks_; |
116 }; | 126 }; |
117 | 127 |
118 } // namespace cast | 128 } // namespace cast |
119 } // namespace media | 129 } // namespace media |
120 | 130 |
121 #endif // MEDIA_CAST_AUDIO_RECEIVER_AUDIO_RECEIVER_H_ | 131 #endif // MEDIA_CAST_AUDIO_RECEIVER_AUDIO_RECEIVER_H_ |
OLD | NEW |