| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SENDER_AUDIO_SENDER_H_ | 5 #ifndef MEDIA_CAST_SENDER_AUDIO_SENDER_H_ |
| 6 #define MEDIA_CAST_SENDER_AUDIO_SENDER_H_ | 6 #define MEDIA_CAST_SENDER_AUDIO_SENDER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/threading/non_thread_safe.h" | |
| 15 #include "base/time/tick_clock.h" | 14 #include "base/time/tick_clock.h" |
| 16 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 17 #include "media/base/audio_bus.h" | 16 #include "media/base/audio_bus.h" |
| 18 #include "media/cast/cast_config.h" | 17 #include "media/cast/cast_config.h" |
| 19 #include "media/cast/cast_sender.h" | 18 #include "media/cast/cast_sender.h" |
| 20 #include "media/cast/sender/frame_sender.h" | 19 #include "media/cast/sender/frame_sender.h" |
| 21 | 20 |
| 22 namespace media { | 21 namespace media { |
| 23 namespace cast { | 22 namespace cast { |
| 24 | 23 |
| 25 class AudioEncoder; | 24 class AudioEncoder; |
| 26 | 25 |
| 27 // Not thread safe. Only called from the main cast thread. | 26 // Not thread safe. Only called from the main cast thread. |
| 28 // This class owns all objects related to sending audio, objects that create RTP | 27 // This class owns all objects related to sending audio, objects that create RTP |
| 29 // packets, congestion control, audio encoder, parsing and sending of | 28 // packets, congestion control, audio encoder, parsing and sending of |
| 30 // RTCP packets. | 29 // RTCP packets. |
| 31 // Additionally it posts a bunch of delayed tasks to the main thread for various | 30 // Additionally it posts a bunch of delayed tasks to the main thread for various |
| 32 // timeouts. | 31 // timeouts. |
| 33 class AudioSender : public FrameSender, public base::NonThreadSafe { | 32 class AudioSender : public FrameSender { |
| 34 public: | 33 public: |
| 35 AudioSender(scoped_refptr<CastEnvironment> cast_environment, | 34 AudioSender(scoped_refptr<CastEnvironment> cast_environment, |
| 36 const FrameSenderConfig& audio_config, | 35 const FrameSenderConfig& audio_config, |
| 37 const StatusChangeCallback& status_change_cb, | 36 const StatusChangeCallback& status_change_cb, |
| 38 CastTransport* const transport_sender); | 37 CastTransport* const transport_sender); |
| 39 | 38 |
| 40 ~AudioSender() final; | 39 ~AudioSender() final; |
| 41 | 40 |
| 42 // Note: It is not guaranteed that |audio_frame| will actually be encoded and | 41 // Note: It is not guaranteed that |audio_frame| will actually be encoded and |
| 43 // sent, if AudioSender detects too many frames in flight. Therefore, clients | 42 // sent, if AudioSender detects too many frames in flight. Therefore, clients |
| (...skipping 22 matching lines...) Expand all Loading... |
| 66 // NOTE: Weak pointers must be invalidated before all other member variables. | 65 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 67 base::WeakPtrFactory<AudioSender> weak_factory_; | 66 base::WeakPtrFactory<AudioSender> weak_factory_; |
| 68 | 67 |
| 69 DISALLOW_COPY_AND_ASSIGN(AudioSender); | 68 DISALLOW_COPY_AND_ASSIGN(AudioSender); |
| 70 }; | 69 }; |
| 71 | 70 |
| 72 } // namespace cast | 71 } // namespace cast |
| 73 } // namespace media | 72 } // namespace media |
| 74 | 73 |
| 75 #endif // MEDIA_CAST_SENDER_AUDIO_SENDER_H_ | 74 #endif // MEDIA_CAST_SENDER_AUDIO_SENDER_H_ |
| OLD | NEW |