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_AUDIO_ENCODER_H_ | 5 #ifndef MEDIA_CAST_AUDIO_SENDER_AUDIO_ENCODER_H_ |
6 #define MEDIA_CAST_AUDIO_SENDER_AUDIO_ENCODER_H_ | 6 #define MEDIA_CAST_AUDIO_SENDER_AUDIO_ENCODER_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" |
11 #include "media/base/audio_bus.h" | 11 #include "media/base/audio_bus.h" |
12 #include "media/cast/cast_config.h" | 12 #include "media/cast/cast_config.h" |
13 #include "media/cast/cast_environment.h" | 13 #include "media/cast/cast_environment.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class TimeTicks; | 16 class TimeTicks; |
17 } | 17 } |
18 | 18 |
19 namespace media { | 19 namespace media { |
20 namespace cast { | 20 namespace cast { |
21 | 21 |
22 class AudioEncoder { | 22 class AudioEncoder { |
23 public: | 23 public: |
24 typedef base::Callback<void(scoped_ptr<transport::EncodedAudioFrame>, | 24 typedef base::Callback<void(scoped_ptr<transport::EncodedFrame>)> |
25 const base::TimeTicks&)> FrameEncodedCallback; | 25 FrameEncodedCallback; |
26 | 26 |
27 AudioEncoder(const scoped_refptr<CastEnvironment>& cast_environment, | 27 AudioEncoder(const scoped_refptr<CastEnvironment>& cast_environment, |
28 const AudioSenderConfig& audio_config, | 28 const AudioSenderConfig& audio_config, |
29 const FrameEncodedCallback& frame_encoded_callback); | 29 const FrameEncodedCallback& frame_encoded_callback); |
30 virtual ~AudioEncoder(); | 30 virtual ~AudioEncoder(); |
31 | 31 |
32 CastInitializationStatus InitializationResult() const; | 32 CastInitializationStatus InitializationResult() const; |
33 | 33 |
34 void InsertAudio(scoped_ptr<AudioBus> audio_bus, | 34 void InsertAudio(scoped_ptr<AudioBus> audio_bus, |
35 const base::TimeTicks& recorded_time); | 35 const base::TimeTicks& recorded_time); |
36 | 36 |
37 private: | 37 private: |
38 class ImplBase; | 38 class ImplBase; |
39 class OpusImpl; | 39 class OpusImpl; |
40 class Pcm16Impl; | 40 class Pcm16Impl; |
41 | 41 |
42 const scoped_refptr<CastEnvironment> cast_environment_; | 42 const scoped_refptr<CastEnvironment> cast_environment_; |
43 scoped_refptr<ImplBase> impl_; | 43 scoped_refptr<ImplBase> impl_; |
44 | 44 |
45 // Used to ensure only one thread invokes InsertAudio(). | 45 // Used to ensure only one thread invokes InsertAudio(). |
46 base::ThreadChecker insert_thread_checker_; | 46 base::ThreadChecker insert_thread_checker_; |
47 | 47 |
48 DISALLOW_COPY_AND_ASSIGN(AudioEncoder); | 48 DISALLOW_COPY_AND_ASSIGN(AudioEncoder); |
49 }; | 49 }; |
50 | 50 |
51 } // namespace cast | 51 } // namespace cast |
52 } // namespace media | 52 } // namespace media |
53 | 53 |
54 #endif // MEDIA_CAST_AUDIO_SENDER_AUDIO_ENCODER_H_ | 54 #endif // MEDIA_CAST_AUDIO_SENDER_AUDIO_ENCODER_H_ |
OLD | NEW |