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" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 const RtpCastHeader& rtp_header); | 72 const RtpCastHeader& rtp_header); |
73 private: | 73 private: |
74 friend class LocalRtpAudioData; | 74 friend class LocalRtpAudioData; |
75 friend class LocalRtpAudioFeedback; | 75 friend class LocalRtpAudioFeedback; |
76 | 76 |
77 void CastFeedback(const RtcpCastMessage& cast_message); | 77 void CastFeedback(const RtcpCastMessage& cast_message); |
78 | 78 |
79 // Time to pull out the audio even though we are missing data. | 79 // Time to pull out the audio even though we are missing data. |
80 void PlayoutTimeout(); | 80 void PlayoutTimeout(); |
81 | 81 |
82 bool PostEncodedAudioFrame(const AudioFrameEncodedCallback& callback, | 82 bool PostEncodedAudioFrame( |
83 uint32 rtp_timestamp, | 83 const AudioFrameEncodedCallback& callback, |
84 bool next_frame, | 84 uint32 rtp_timestamp, |
85 scoped_ptr<EncodedAudioFrame>* encoded_frame); | 85 bool next_frame, |
| 86 scoped_ptr<transport::EncodedAudioFrame>* encoded_frame); |
86 | 87 |
87 // Actual decoding implementation - should be called under the audio decoder | 88 // Actual decoding implementation - should be called under the audio decoder |
88 // thread. | 89 // thread. |
89 void DecodeAudioFrameThread(int number_of_10ms_blocks, | 90 void DecodeAudioFrameThread(int number_of_10ms_blocks, |
90 int desired_frequency, | 91 int desired_frequency, |
91 const AudioFrameDecodedCallback callback); | 92 const AudioFrameDecodedCallback callback); |
92 void ReturnDecodedFrameWithPlayoutDelay( | 93 void ReturnDecodedFrameWithPlayoutDelay( |
93 scoped_ptr<PcmAudioFrame> audio_frame, uint32 rtp_timestamp, | 94 scoped_ptr<PcmAudioFrame> audio_frame, uint32 rtp_timestamp, |
94 const AudioFrameDecodedCallback callback); | 95 const AudioFrameDecodedCallback callback); |
95 | 96 |
96 // Return the playout time based on the current time and rtp timestamp. | 97 // Return the playout time based on the current time and rtp timestamp. |
97 base::TimeTicks GetPlayoutTime(base::TimeTicks now, uint32 rtp_timestamp); | 98 base::TimeTicks GetPlayoutTime(base::TimeTicks now, uint32 rtp_timestamp); |
98 | 99 |
99 void InitializeTimers(); | 100 void InitializeTimers(); |
100 | 101 |
101 // Decrypts the data within the |audio_frame| and replaces the data with the | 102 // Decrypts the data within the |audio_frame| and replaces the data with the |
102 // decrypted string. | 103 // decrypted string. |
103 bool DecryptAudioFrame(scoped_ptr<EncodedAudioFrame>* audio_frame); | 104 bool DecryptAudioFrame(scoped_ptr<transport::EncodedAudioFrame>* audio_frame); |
104 | 105 |
105 // Schedule the next RTCP report. | 106 // Schedule the next RTCP report. |
106 void ScheduleNextRtcpReport(); | 107 void ScheduleNextRtcpReport(); |
107 | 108 |
108 // Actually send the next RTCP report. | 109 // Actually send the next RTCP report. |
109 void SendNextRtcpReport(); | 110 void SendNextRtcpReport(); |
110 | 111 |
111 // Schedule timing for the next cast message. | 112 // Schedule timing for the next cast message. |
112 void ScheduleNextCastMessage(); | 113 void ScheduleNextCastMessage(); |
113 | 114 |
114 // Actually send the next cast message. | 115 // Actually send the next cast message. |
115 void SendNextCastMessage(); | 116 void SendNextCastMessage(); |
116 | 117 |
117 scoped_refptr<CastEnvironment> cast_environment_; | 118 scoped_refptr<CastEnvironment> cast_environment_; |
118 base::WeakPtrFactory<AudioReceiver> weak_factory_; | 119 base::WeakPtrFactory<AudioReceiver> weak_factory_; |
119 | 120 |
120 const AudioCodec codec_; | 121 const transport::AudioCodec codec_; |
121 const int frequency_; | 122 const int frequency_; |
122 base::TimeDelta target_delay_delta_; | 123 base::TimeDelta target_delay_delta_; |
123 scoped_ptr<Framer> audio_buffer_; | 124 scoped_ptr<Framer> audio_buffer_; |
124 scoped_ptr<AudioDecoder> audio_decoder_; | 125 scoped_ptr<AudioDecoder> audio_decoder_; |
125 scoped_ptr<LocalRtpAudioData> incoming_payload_callback_; | 126 scoped_ptr<LocalRtpAudioData> incoming_payload_callback_; |
126 scoped_ptr<LocalRtpAudioFeedback> incoming_payload_feedback_; | 127 scoped_ptr<LocalRtpAudioFeedback> incoming_payload_feedback_; |
127 scoped_ptr<RtpReceiver> rtp_receiver_; | 128 scoped_ptr<RtpReceiver> rtp_receiver_; |
128 scoped_ptr<Rtcp> rtcp_; | 129 scoped_ptr<Rtcp> rtcp_; |
129 scoped_ptr<RtpReceiverStatistics> rtp_audio_receiver_statistics_; | 130 scoped_ptr<RtpReceiverStatistics> rtp_audio_receiver_statistics_; |
130 base::TimeDelta time_offset_; | 131 base::TimeDelta time_offset_; |
131 base::TimeTicks time_first_incoming_packet_; | 132 base::TimeTicks time_first_incoming_packet_; |
132 uint32 first_incoming_rtp_timestamp_; | 133 uint32 first_incoming_rtp_timestamp_; |
133 scoped_ptr<crypto::Encryptor> decryptor_; | 134 scoped_ptr<crypto::Encryptor> decryptor_; |
134 scoped_ptr<crypto::SymmetricKey> decryption_key_; | 135 scoped_ptr<crypto::SymmetricKey> decryption_key_; |
135 std::string iv_mask_; | 136 std::string iv_mask_; |
136 base::TimeTicks last_playout_time_; | 137 base::TimeTicks last_playout_time_; |
137 | 138 |
138 std::list<AudioFrameEncodedCallback> queued_encoded_callbacks_; | 139 std::list<AudioFrameEncodedCallback> queued_encoded_callbacks_; |
139 std::list<DecodedAudioCallbackData> queued_decoded_callbacks_; | 140 std::list<DecodedAudioCallbackData> queued_decoded_callbacks_; |
140 }; | 141 }; |
141 | 142 |
142 } // namespace cast | 143 } // namespace cast |
143 } // namespace media | 144 } // namespace media |
144 | 145 |
145 #endif // MEDIA_CAST_AUDIO_RECEIVER_AUDIO_RECEIVER_H_ | 146 #endif // MEDIA_CAST_AUDIO_RECEIVER_AUDIO_RECEIVER_H_ |
OLD | NEW |