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