OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 CHROMECAST_PUBLIC_MEDIA_AUDIO_POST_PROCESSOR_SHLIB_H_ | 5 #ifndef CHROMECAST_PUBLIC_MEDIA_AUDIO_POST_PROCESSOR_SHLIB_H_ |
6 #define CHROMECAST_PUBLIC_MEDIA_AUDIO_POST_PROCESSOR_SHLIB_H_ | 6 #define CHROMECAST_PUBLIC_MEDIA_AUDIO_POST_PROCESSOR_SHLIB_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 // Called from StreamMixerAlsa when shared objects are listed in | 25 // Called from StreamMixerAlsa when shared objects are listed in |
26 // /etc/cast_audio.json | 26 // /etc/cast_audio.json |
27 // AudioPostProcessors are created on startup and only destroyed/reset | 27 // AudioPostProcessors are created on startup and only destroyed/reset |
28 // if the output sample rate changes. | 28 // if the output sample rate changes. |
29 extern "C" CHROMECAST_EXPORT chromecast::media::AudioPostProcessor* | 29 extern "C" CHROMECAST_EXPORT chromecast::media::AudioPostProcessor* |
30 AudioPostProcessorShlib_Create(const std::string& config, int channels); | 30 AudioPostProcessorShlib_Create(const std::string& config, int channels); |
31 | 31 |
32 namespace chromecast { | 32 namespace chromecast { |
33 namespace media { | 33 namespace media { |
34 | 34 |
| 35 // The maximum amount of data that will ever be processed in one call. |
| 36 const int kMaxAudioWriteTimeMilliseconds = 20; |
| 37 |
35 // Interface for AudioPostProcessors used for applying DSP in StreamMixerAlsa. | 38 // Interface for AudioPostProcessors used for applying DSP in StreamMixerAlsa. |
36 class AudioPostProcessor { | 39 class AudioPostProcessor { |
37 public: | 40 public: |
38 // Updates the sample rate of the processor. | 41 // Updates the sample rate of the processor. |
39 // Returns |false| if the processor cannot support |sample_rate| | 42 // Returns |false| if the processor cannot support |sample_rate| |
40 // Returning false will result in crashing cast_shell. | 43 // Returning false will result in crashing cast_shell. |
41 virtual bool SetSampleRate(int sample_rate) = 0; | 44 virtual bool SetSampleRate(int sample_rate) = 0; |
42 | 45 |
43 // Processes audio frames from |data|, overwriting contents. | 46 // Processes audio frames from |data|, overwriting contents. |
44 // |data| will always be 32-bit interleaved float. | 47 // |data| will always be 32-bit interleaved float. |
(...skipping 23 matching lines...) Expand all Loading... |
68 // OEM's do not need to implement this method. | 71 // OEM's do not need to implement this method. |
69 virtual void UpdateParameters(const std::string& message) {} | 72 virtual void UpdateParameters(const std::string& message) {} |
70 | 73 |
71 virtual ~AudioPostProcessor() = default; | 74 virtual ~AudioPostProcessor() = default; |
72 }; | 75 }; |
73 | 76 |
74 } // namespace media | 77 } // namespace media |
75 } // namespace chromecast | 78 } // namespace chromecast |
76 | 79 |
77 #endif // CHROMECAST_PUBLIC_MEDIA_AUDIO_POST_PROCESSOR_SHLIB_H_ | 80 #endif // CHROMECAST_PUBLIC_MEDIA_AUDIO_POST_PROCESSOR_SHLIB_H_ |
OLD | NEW |