| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_TEST_WEBRTC_AUDIO_DEVICE_TEST_H_ | 5 #ifndef CONTENT_TEST_WEBRTC_AUDIO_DEVICE_TEST_H_ |
| 6 #define CONTENT_TEST_WEBRTC_AUDIO_DEVICE_TEST_H_ | 6 #define CONTENT_TEST_WEBRTC_AUDIO_DEVICE_TEST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
| 14 #include "content/browser/renderer_host/media/mock_media_observer.h" | 14 #include "content/browser/renderer_host/media/mock_media_observer.h" |
| 15 #include "content/public/renderer/content_renderer_client.h" | 15 #include "content/public/renderer/content_renderer_client.h" |
| 16 #include "media/base/channel_layout.h" | 16 #include "media/base/channel_layout.h" |
| 17 #include "ipc/ipc_channel.h" | 17 #include "ipc/ipc_channel.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 #include "third_party/webrtc/common_types.h" | 19 #include "third_party/webrtc/common_types.h" |
| 20 | 20 |
| 21 class AudioInputRendererHost; | 21 class AudioInputRendererHost; |
| 22 class AudioRendererHost; | 22 class AudioRendererHost; |
| 23 class RenderThreadImpl; | 23 class RenderThreadImpl; |
| 24 class WebRTCMockRenderProcess; | 24 class WebRTCMockRenderProcess; |
| 25 | 25 |
| 26 namespace base { | |
| 27 namespace win { | |
| 28 class ScopedCOMInitializer; | |
| 29 } | |
| 30 } | |
| 31 | |
| 32 namespace content { | 26 namespace content { |
| 33 class ContentRendererClient; | 27 class ContentRendererClient; |
| 34 class MockResourceContext; | 28 class MockResourceContext; |
| 35 class ResourceContext; | 29 class ResourceContext; |
| 36 class TestBrowserThread; | 30 class TestBrowserThread; |
| 37 } | 31 } |
| 38 | 32 |
| 39 namespace media { | 33 namespace media { |
| 40 class AudioManager; | 34 class AudioManager; |
| 41 } | 35 } |
| 42 | 36 |
| 43 namespace media_stream { | 37 namespace media_stream { |
| 44 class MediaStreamManager; | 38 class MediaStreamManager; |
| 45 } | 39 } |
| 46 | 40 |
| 47 namespace net { | 41 namespace net { |
| 48 class URLRequestContext; | 42 class URLRequestContext; |
| 49 } | 43 } |
| 50 | 44 |
| 51 namespace webrtc { | 45 namespace webrtc { |
| 52 class VoENetwork; | 46 class VoENetwork; |
| 53 } | 47 } |
| 54 | 48 |
| 49 #if defined(OS_WIN) |
| 50 namespace base { |
| 51 namespace win { |
| 52 class ScopedCOMInitializer; |
| 53 } |
| 54 } |
| 55 #endif |
| 56 |
| 55 // Scoped class for WebRTC interfaces. Fetches the wrapped interface | 57 // Scoped class for WebRTC interfaces. Fetches the wrapped interface |
| 56 // in the constructor via WebRTC's GetInterface mechanism and then releases | 58 // in the constructor via WebRTC's GetInterface mechanism and then releases |
| 57 // the reference in the destructor. | 59 // the reference in the destructor. |
| 58 template<typename T> | 60 template<typename T> |
| 59 class ScopedWebRTCPtr { | 61 class ScopedWebRTCPtr { |
| 60 public: | 62 public: |
| 61 template<typename Engine> | 63 template<typename Engine> |
| 62 explicit ScopedWebRTCPtr(Engine* e) | 64 explicit ScopedWebRTCPtr(Engine* e) |
| 63 : ptr_(T::GetInterface(e)) {} | 65 : ptr_(T::GetInterface(e)) {} |
| 64 explicit ScopedWebRTCPtr(T* p) : ptr_(p) {} | 66 explicit ScopedWebRTCPtr(T* p) : ptr_(p) {} |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 scoped_ptr<IPC::Channel> channel_; | 174 scoped_ptr<IPC::Channel> channel_; |
| 173 scoped_refptr<AudioRendererHost> audio_render_host_; | 175 scoped_refptr<AudioRendererHost> audio_render_host_; |
| 174 scoped_refptr<AudioInputRendererHost> audio_input_renderer_host_; | 176 scoped_refptr<AudioInputRendererHost> audio_input_renderer_host_; |
| 175 | 177 |
| 176 AudioUtilInterface* audio_util_callback_; // Weak reference. | 178 AudioUtilInterface* audio_util_callback_; // Weak reference. |
| 177 | 179 |
| 178 // Initialized on the main test thread that we mark as the UI thread. | 180 // Initialized on the main test thread that we mark as the UI thread. |
| 179 scoped_ptr<content::TestBrowserThread> ui_thread_; | 181 scoped_ptr<content::TestBrowserThread> ui_thread_; |
| 180 // Initialized on our IO thread to satisfy BrowserThread::IO checks. | 182 // Initialized on our IO thread to satisfy BrowserThread::IO checks. |
| 181 scoped_ptr<content::TestBrowserThread> io_thread_; | 183 scoped_ptr<content::TestBrowserThread> io_thread_; |
| 182 // COM initialization on the IO thread for Windows. | 184 |
| 185 #if defined(OS_WIN) |
| 186 // COM initialization on the IO thread. |
| 183 scoped_ptr<base::win::ScopedCOMInitializer> initialize_com_; | 187 scoped_ptr<base::win::ScopedCOMInitializer> initialize_com_; |
| 188 #endif |
| 184 | 189 |
| 185 // These are initialized when we set up our IO thread. | 190 // These are initialized when we set up our IO thread. |
| 186 bool has_input_devices_; | 191 bool has_input_devices_; |
| 187 bool has_output_devices_; | 192 bool has_output_devices_; |
| 188 | 193 |
| 189 // The previous state for whether sandbox support was enabled in | 194 // The previous state for whether sandbox support was enabled in |
| 190 // RenderViewWebKitPlatformSupportImpl. | 195 // RenderViewWebKitPlatformSupportImpl. |
| 191 bool sandbox_was_enabled_; | 196 bool sandbox_was_enabled_; |
| 192 }; | 197 }; |
| 193 | 198 |
| 194 // A very basic implementation of webrtc::Transport that acts as a transport | 199 // A very basic implementation of webrtc::Transport that acts as a transport |
| 195 // but just forwards all calls to a local webrtc::VoENetwork implementation. | 200 // but just forwards all calls to a local webrtc::VoENetwork implementation. |
| 196 // Ownership of the VoENetwork object lies outside the class. | 201 // Ownership of the VoENetwork object lies outside the class. |
| 197 class WebRTCTransportImpl : public webrtc::Transport { | 202 class WebRTCTransportImpl : public webrtc::Transport { |
| 198 public: | 203 public: |
| 199 explicit WebRTCTransportImpl(webrtc::VoENetwork* network); | 204 explicit WebRTCTransportImpl(webrtc::VoENetwork* network); |
| 200 virtual ~WebRTCTransportImpl(); | 205 virtual ~WebRTCTransportImpl(); |
| 201 | 206 |
| 202 virtual int SendPacket(int channel, const void* data, int len) OVERRIDE; | 207 virtual int SendPacket(int channel, const void* data, int len) OVERRIDE; |
| 203 virtual int SendRTCPPacket(int channel, const void* data, int len) OVERRIDE; | 208 virtual int SendRTCPPacket(int channel, const void* data, int len) OVERRIDE; |
| 204 | 209 |
| 205 private: | 210 private: |
| 206 webrtc::VoENetwork* network_; | 211 webrtc::VoENetwork* network_; |
| 207 }; | 212 }; |
| 208 | 213 |
| 209 #endif // CONTENT_TEST_WEBRTC_AUDIO_DEVICE_TEST_H_ | 214 #endif // CONTENT_TEST_WEBRTC_AUDIO_DEVICE_TEST_H_ |
| OLD | NEW |