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