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