Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Side by Side Diff: content/shell/renderer/layout_test/test_media_stream_renderer_factory.cc

Issue 1815033003: Add srcObject attribute of type MediaStream to HTMLMediaElement. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: philipj's comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "content/shell/renderer/layout_test/test_media_stream_renderer_factory. h" 5 #include "content/shell/renderer/layout_test/test_media_stream_renderer_factory. h"
6 6
7 #include "content/shell/renderer/layout_test/test_video_frame_provider.h" 7 #include "content/shell/renderer/layout_test/test_video_frame_provider.h"
8 #include "third_party/WebKit/public/platform/WebMediaStream.h" 8 #include "third_party/WebKit/public/platform/WebMediaStream.h"
9 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" 9 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
10 #include "third_party/WebKit/public/web/WebMediaStreamRegistry.h" 10 #include "third_party/WebKit/public/web/WebMediaStreamRegistry.h"
11 #include "url/gurl.h" 11 #include "url/gurl.h"
12 12
13 using namespace blink; 13 using namespace blink;
14 14
15 namespace { 15 namespace {
16 16
17 static const int kVideoCaptureWidth = 352; 17 static const int kVideoCaptureWidth = 352;
18 static const int kVideoCaptureHeight = 288; 18 static const int kVideoCaptureHeight = 288;
19 static const int kVideoCaptureFrameDurationMs = 33; 19 static const int kVideoCaptureFrameDurationMs = 33;
20 20
21 bool IsMockMediaStreamWithVideo(const WebURL& url) { 21 bool IsMockMediaStreamWithVideo(const WebMediaStream& web_stream) {
22 #if ENABLE_WEBRTC 22 #if ENABLE_WEBRTC
23 WebMediaStream descriptor( 23 if (web_stream.isNull())
24 WebMediaStreamRegistry::lookupMediaStreamDescriptor(url));
25 if (descriptor.isNull())
26 return false; 24 return false;
27 WebVector<WebMediaStreamTrack> video_tracks; 25 WebVector<WebMediaStreamTrack> video_tracks;
28 descriptor.videoTracks(video_tracks); 26 web_stream.videoTracks(video_tracks);
29 return video_tracks.size() > 0; 27 return video_tracks.size() > 0;
30 #else 28 #else
31 return false; 29 return false;
32 #endif 30 #endif
33 } 31 }
34 32
35 } // namespace 33 } // namespace
36 34
37 namespace content { 35 namespace content {
38 36
39 TestMediaStreamRendererFactory::TestMediaStreamRendererFactory() {} 37 TestMediaStreamRendererFactory::TestMediaStreamRendererFactory() {}
40 38
41 TestMediaStreamRendererFactory::~TestMediaStreamRendererFactory() {} 39 TestMediaStreamRendererFactory::~TestMediaStreamRendererFactory() {}
42 40
43 scoped_refptr<VideoFrameProvider> 41 scoped_refptr<VideoFrameProvider>
44 TestMediaStreamRendererFactory::GetVideoFrameProvider( 42 TestMediaStreamRendererFactory::GetVideoFrameProvider(
45 const GURL& url, 43 const blink::WebMediaStream& web_stream,
46 const base::Closure& error_cb, 44 const base::Closure& error_cb,
47 const VideoFrameProvider::RepaintCB& repaint_cb, 45 const VideoFrameProvider::RepaintCB& repaint_cb,
48 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, 46 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner,
49 const scoped_refptr<base::TaskRunner>& worker_task_runner, 47 const scoped_refptr<base::TaskRunner>& worker_task_runner,
50 media::GpuVideoAcceleratorFactories* gpu_factories) { 48 media::GpuVideoAcceleratorFactories* gpu_factories) {
51 if (!IsMockMediaStreamWithVideo(url)) 49 if (!IsMockMediaStreamWithVideo(web_stream))
52 return NULL; 50 return NULL;
53 51
54 return new TestVideoFrameProvider( 52 return new TestVideoFrameProvider(
55 gfx::Size(kVideoCaptureWidth, kVideoCaptureHeight), 53 gfx::Size(kVideoCaptureWidth, kVideoCaptureHeight),
56 base::TimeDelta::FromMilliseconds(kVideoCaptureFrameDurationMs), 54 base::TimeDelta::FromMilliseconds(kVideoCaptureFrameDurationMs),
57 error_cb, 55 error_cb,
58 repaint_cb); 56 repaint_cb);
59 } 57 }
60 58
61 scoped_refptr<MediaStreamAudioRenderer> 59 scoped_refptr<MediaStreamAudioRenderer>
62 TestMediaStreamRendererFactory::GetAudioRenderer( 60 TestMediaStreamRendererFactory::GetAudioRenderer(
63 const GURL& url, 61 const blink::WebMediaStream& web_stream,
64 int render_frame_id, 62 int render_frame_id,
65 const std::string& device_id, 63 const std::string& device_id,
66 const url::Origin& security_origin) { 64 const url::Origin& security_origin) {
67 return NULL; 65 return NULL;
68 } 66 }
69 67
70 } // namespace content 68 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698