| 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 #include "content/test/test_media_stream_client.h" | 5 #include "content/test/test_media_stream_client.h" |
| 6 | 6 |
| 7 #include "content/renderer/media/media_stream_audio_renderer.h" |
| 7 #include "content/test/test_video_frame_provider.h" | 8 #include "content/test/test_video_frame_provider.h" |
| 8 #include "third_party/WebKit/public/platform/WebMediaStream.h" | 9 #include "third_party/WebKit/public/platform/WebMediaStream.h" |
| 9 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 10 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
| 10 #include "third_party/WebKit/public/platform/WebVector.h" | |
| 11 #include "third_party/WebKit/public/web/WebMediaStreamRegistry.h" | 11 #include "third_party/WebKit/public/web/WebMediaStreamRegistry.h" |
| 12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
| 13 #include "webkit/renderer/media/media_stream_audio_renderer.h" | |
| 14 | 13 |
| 15 using namespace WebKit; | 14 using namespace WebKit; |
| 16 | 15 |
| 17 namespace { | 16 namespace { |
| 18 | 17 |
| 19 static const int kVideoCaptureWidth = 352; | 18 static const int kVideoCaptureWidth = 352; |
| 20 static const int kVideoCaptureHeight = 288; | 19 static const int kVideoCaptureHeight = 288; |
| 21 static const int kVideoCaptureFrameDurationMs = 33; | 20 static const int kVideoCaptureFrameDurationMs = 33; |
| 22 | 21 |
| 23 bool IsMockMediaStreamWithVideo(const WebURL& url) { | 22 bool IsMockMediaStreamWithVideo(const WebURL& url) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 40 | 39 |
| 41 TestMediaStreamClient::TestMediaStreamClient(RenderView* render_view) | 40 TestMediaStreamClient::TestMediaStreamClient(RenderView* render_view) |
| 42 : RenderViewObserver(render_view) {} | 41 : RenderViewObserver(render_view) {} |
| 43 | 42 |
| 44 TestMediaStreamClient::~TestMediaStreamClient() {} | 43 TestMediaStreamClient::~TestMediaStreamClient() {} |
| 45 | 44 |
| 46 bool TestMediaStreamClient::IsMediaStream(const GURL& url) { | 45 bool TestMediaStreamClient::IsMediaStream(const GURL& url) { |
| 47 return IsMockMediaStreamWithVideo(url); | 46 return IsMockMediaStreamWithVideo(url); |
| 48 } | 47 } |
| 49 | 48 |
| 50 scoped_refptr<webkit_media::VideoFrameProvider> | 49 scoped_refptr<VideoFrameProvider> TestMediaStreamClient::GetVideoFrameProvider( |
| 51 TestMediaStreamClient::GetVideoFrameProvider( | |
| 52 const GURL& url, | 50 const GURL& url, |
| 53 const base::Closure& error_cb, | 51 const base::Closure& error_cb, |
| 54 const webkit_media::VideoFrameProvider::RepaintCB& repaint_cb) { | 52 const VideoFrameProvider::RepaintCB& repaint_cb) { |
| 55 if (!IsMockMediaStreamWithVideo(url)) | 53 if (!IsMockMediaStreamWithVideo(url)) |
| 56 return NULL; | 54 return NULL; |
| 57 | 55 |
| 58 return new TestVideoFrameProvider( | 56 return new TestVideoFrameProvider( |
| 59 gfx::Size(kVideoCaptureWidth, kVideoCaptureHeight), | 57 gfx::Size(kVideoCaptureWidth, kVideoCaptureHeight), |
| 60 base::TimeDelta::FromMilliseconds(kVideoCaptureFrameDurationMs), | 58 base::TimeDelta::FromMilliseconds(kVideoCaptureFrameDurationMs), |
| 61 error_cb, | 59 error_cb, |
| 62 repaint_cb); | 60 repaint_cb); |
| 63 } | 61 } |
| 64 | 62 |
| 65 scoped_refptr<webkit_media::MediaStreamAudioRenderer> | 63 scoped_refptr<MediaStreamAudioRenderer> TestMediaStreamClient::GetAudioRenderer( |
| 66 TestMediaStreamClient::GetAudioRenderer(const GURL& url) { | 64 const GURL& url) { |
| 67 return NULL; | 65 return NULL; |
| 68 } | 66 } |
| 69 | 67 |
| 70 } // namespace content | 68 } // namespace content |
| OLD | NEW |