| 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/net/rtp_sender/rtp_sender.h" | |
| 18 #include "media/cast/rtcp/rtcp.h" | 17 #include "media/cast/rtcp/rtcp.h" |
| 18 #include "media/cast/transport/rtp_sender/rtp_sender.h" |
| 19 | 19 |
| 20 namespace crypto { | 20 namespace crypto { |
| 21 class Encryptor; | 21 class Encryptor; |
| 22 class SymmetricKey; | 22 class SymmetricKey; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace media { | 25 namespace media { |
| 26 class AudioBus; | 26 class AudioBus; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace media { | 29 namespace media { |
| 30 namespace cast { | 30 namespace cast { |
| 31 | 31 |
| 32 class AudioEncoder; | 32 class AudioEncoder; |
| 33 class LocalRtcpAudioSenderFeedback; | 33 class LocalRtcpAudioSenderFeedback; |
| 34 class LocalRtpSenderStatistics; | 34 class LocalRtpSenderStatistics; |
| 35 class PacedPacketSender; | |
| 36 | 35 |
| 37 // This class is not thread safe. | 36 // This class is not thread safe. |
| 38 // It's only called from the main cast thread. | 37 // It's only called from the main cast thread. |
| 39 class AudioSender : public base::NonThreadSafe, | 38 class AudioSender : public base::NonThreadSafe, |
| 40 public base::SupportsWeakPtr<AudioSender> { | 39 public base::SupportsWeakPtr<AudioSender> { |
| 41 public: | 40 public: |
| 42 AudioSender(scoped_refptr<CastEnvironment> cast_environment, | 41 AudioSender(scoped_refptr<CastEnvironment> cast_environment, |
| 43 const AudioSenderConfig& audio_config, | 42 const AudioSenderConfig& audio_config, |
| 44 PacedPacketSender* const paced_packet_sender); | 43 transport::PacedPacketSender* const paced_packet_sender); |
| 45 | 44 |
| 46 virtual ~AudioSender(); | 45 virtual ~AudioSender(); |
| 47 | 46 |
| 48 // The |audio_bus| must be valid until the |done_callback| is called. | 47 // The |audio_bus| must be valid until the |done_callback| is called. |
| 49 // The callback is called from the main cast thread as soon as the encoder is | 48 // The callback is called from the main cast thread as soon as the encoder is |
| 50 // done with |audio_bus|; it does not mean that the encoded data has been | 49 // done with |audio_bus|; it does not mean that the encoded data has been |
| 51 // sent out. | 50 // sent out. |
| 52 void InsertAudio(const AudioBus* audio_bus, | 51 void InsertAudio(const AudioBus* audio_bus, |
| 53 const base::TimeTicks& recorded_time, | 52 const base::TimeTicks& recorded_time, |
| 54 const base::Closure& done_callback); | 53 const base::Closure& done_callback); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 82 | 81 |
| 83 void ScheduleNextRtcpReport(); | 82 void ScheduleNextRtcpReport(); |
| 84 void SendRtcpReport(); | 83 void SendRtcpReport(); |
| 85 | 84 |
| 86 void InitializeTimers(); | 85 void InitializeTimers(); |
| 87 | 86 |
| 88 base::WeakPtrFactory<AudioSender> weak_factory_; | 87 base::WeakPtrFactory<AudioSender> weak_factory_; |
| 89 | 88 |
| 90 scoped_refptr<CastEnvironment> cast_environment_; | 89 scoped_refptr<CastEnvironment> cast_environment_; |
| 91 scoped_refptr<AudioEncoder> audio_encoder_; | 90 scoped_refptr<AudioEncoder> audio_encoder_; |
| 92 RtpSender rtp_sender_; | 91 transport::RtpSender rtp_sender_; |
| 93 scoped_ptr<LocalRtpSenderStatistics> rtp_audio_sender_statistics_; | 92 scoped_ptr<LocalRtpSenderStatistics> rtp_audio_sender_statistics_; |
| 94 scoped_ptr<LocalRtcpAudioSenderFeedback> rtcp_feedback_; | 93 scoped_ptr<LocalRtcpAudioSenderFeedback> rtcp_feedback_; |
| 95 Rtcp rtcp_; | 94 Rtcp rtcp_; |
| 96 bool initialized_; | 95 bool initialized_; |
| 97 scoped_ptr<crypto::Encryptor> encryptor_; | 96 scoped_ptr<crypto::Encryptor> encryptor_; |
| 98 scoped_ptr<crypto::SymmetricKey> encryption_key_; | 97 scoped_ptr<crypto::SymmetricKey> encryption_key_; |
| 99 std::string iv_mask_; | 98 std::string iv_mask_; |
| 100 | 99 |
| 101 DISALLOW_COPY_AND_ASSIGN(AudioSender); | 100 DISALLOW_COPY_AND_ASSIGN(AudioSender); |
| 102 }; | 101 }; |
| 103 | 102 |
| 104 } // namespace cast | 103 } // namespace cast |
| 105 } // namespace media | 104 } // namespace media |
| 106 | 105 |
| 107 #endif // MEDIA_CAST_AUDIO_SENDER_H_ | 106 #endif // MEDIA_CAST_AUDIO_SENDER_H_ |
| OLD | NEW |