| 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 CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_STREAM_AUDIO_TRACK_HOST_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_STREAM_AUDIO_TRACK_HOST_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_STREAM_AUDIO_TRACK_HOST_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_STREAM_AUDIO_TRACK_HOST_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 // Send enqueue buffer message on the main thread. | 61 // Send enqueue buffer message on the main thread. |
| 62 void SendEnqueueBufferMessageOnMainThread(int32_t index, | 62 void SendEnqueueBufferMessageOnMainThread(int32_t index, |
| 63 int32_t buffers_generation); | 63 int32_t buffers_generation); |
| 64 | 64 |
| 65 // MediaStreamAudioSink overrides: | 65 // MediaStreamAudioSink overrides: |
| 66 // These two functions should be called on the audio thread. | 66 // These two functions should be called on the audio thread. |
| 67 virtual void OnData(const int16* audio_data, | 67 virtual void OnData(const int16* audio_data, |
| 68 int sample_rate, | 68 int sample_rate, |
| 69 int number_of_channels, | 69 int number_of_channels, |
| 70 int number_of_frames) OVERRIDE; | 70 int number_of_frames) override; |
| 71 virtual void OnSetFormat(const media::AudioParameters& params) OVERRIDE; | 71 virtual void OnSetFormat(const media::AudioParameters& params) override; |
| 72 | 72 |
| 73 // Unowned host which is available during the AudioSink's lifespan. | 73 // Unowned host which is available during the AudioSink's lifespan. |
| 74 // It is mainly used in the main thread. But the audio thread will use | 74 // It is mainly used in the main thread. But the audio thread will use |
| 75 // host_->buffer_manager() to read some buffer properties. It is safe | 75 // host_->buffer_manager() to read some buffer properties. It is safe |
| 76 // because the buffer_manager()'s properties will not be changed after | 76 // because the buffer_manager()'s properties will not be changed after |
| 77 // initialization. | 77 // initialization. |
| 78 PepperMediaStreamAudioTrackHost* host_; | 78 PepperMediaStreamAudioTrackHost* host_; |
| 79 | 79 |
| 80 // Timestamp of the next received audio buffer. | 80 // Timestamp of the next received audio buffer. |
| 81 // Access only on the audio thread. | 81 // Access only on the audio thread. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 base::WeakPtrFactory<AudioSink> weak_factory_; | 146 base::WeakPtrFactory<AudioSink> weak_factory_; |
| 147 | 147 |
| 148 DISALLOW_COPY_AND_ASSIGN(AudioSink); | 148 DISALLOW_COPY_AND_ASSIGN(AudioSink); |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 virtual ~PepperMediaStreamAudioTrackHost(); | 151 virtual ~PepperMediaStreamAudioTrackHost(); |
| 152 | 152 |
| 153 // ResourceMessageHandler overrides: | 153 // ResourceMessageHandler overrides: |
| 154 virtual int32_t OnResourceMessageReceived( | 154 virtual int32_t OnResourceMessageReceived( |
| 155 const IPC::Message& msg, | 155 const IPC::Message& msg, |
| 156 ppapi::host::HostMessageContext* context) OVERRIDE; | 156 ppapi::host::HostMessageContext* context) override; |
| 157 | 157 |
| 158 // Message handlers: | 158 // Message handlers: |
| 159 int32_t OnHostMsgConfigure( | 159 int32_t OnHostMsgConfigure( |
| 160 ppapi::host::HostMessageContext* context, | 160 ppapi::host::HostMessageContext* context, |
| 161 const ppapi::MediaStreamAudioTrackShared::Attributes& attributes); | 161 const ppapi::MediaStreamAudioTrackShared::Attributes& attributes); |
| 162 | 162 |
| 163 // PepperMediaStreamTrackHostBase overrides: | 163 // PepperMediaStreamTrackHostBase overrides: |
| 164 virtual void OnClose() OVERRIDE; | 164 virtual void OnClose() override; |
| 165 | 165 |
| 166 // MediaStreamBufferManager::Delegate overrides: | 166 // MediaStreamBufferManager::Delegate overrides: |
| 167 virtual void OnNewBufferEnqueued() OVERRIDE; | 167 virtual void OnNewBufferEnqueued() override; |
| 168 | 168 |
| 169 // ResourceHost overrides: | 169 // ResourceHost overrides: |
| 170 virtual void DidConnectPendingHostToResource() OVERRIDE; | 170 virtual void DidConnectPendingHostToResource() override; |
| 171 | 171 |
| 172 blink::WebMediaStreamTrack track_; | 172 blink::WebMediaStreamTrack track_; |
| 173 | 173 |
| 174 // True if |audio_sink_| has been added to |blink::WebMediaStreamTrack| | 174 // True if |audio_sink_| has been added to |blink::WebMediaStreamTrack| |
| 175 // as a sink. | 175 // as a sink. |
| 176 bool connected_; | 176 bool connected_; |
| 177 | 177 |
| 178 AudioSink audio_sink_; | 178 AudioSink audio_sink_; |
| 179 | 179 |
| 180 DISALLOW_COPY_AND_ASSIGN(PepperMediaStreamAudioTrackHost); | 180 DISALLOW_COPY_AND_ASSIGN(PepperMediaStreamAudioTrackHost); |
| 181 }; | 181 }; |
| 182 | 182 |
| 183 } // namespace content | 183 } // namespace content |
| 184 | 184 |
| 185 #endif // CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_STREAM_AUDIO_TRACK_HOST_H_ | 185 #endif // CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_STREAM_AUDIO_TRACK_HOST_H_ |
| OLD | NEW |