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
3 // found in the LICENSE file.
5 #include "content/test/test_media_stream_renderer_factory.h"
7 #include "content/renderer/media/media_stream_audio_renderer.h"
8 #include "content/test/test_video_frame_provider.h"
9 #include "third_party/WebKit/public/platform/WebMediaStream.h"
10 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
11 #include "third_party/WebKit/public/web/WebMediaStreamRegistry.h"
14 using namespace blink
;
18 static const int kVideoCaptureWidth
= 352;
19 static const int kVideoCaptureHeight
= 288;
20 static const int kVideoCaptureFrameDurationMs
= 33;
22 bool IsMockMediaStreamWithVideo(const WebURL
& url
) {
24 WebMediaStream
descriptor(
25 WebMediaStreamRegistry::lookupMediaStreamDescriptor(url
));
26 if (descriptor
.isNull())
28 WebVector
<WebMediaStreamTrack
> video_tracks
;
29 descriptor
.videoTracks(video_tracks
);
30 return video_tracks
.size() > 0;
40 TestMediaStreamRendererFactory::TestMediaStreamRendererFactory() {}
42 TestMediaStreamRendererFactory::~TestMediaStreamRendererFactory() {}
44 scoped_refptr
<VideoFrameProvider
>
45 TestMediaStreamRendererFactory::GetVideoFrameProvider(
47 const base::Closure
& error_cb
,
48 const VideoFrameProvider::RepaintCB
& repaint_cb
) {
49 if (!IsMockMediaStreamWithVideo(url
))
52 return new TestVideoFrameProvider(
53 gfx::Size(kVideoCaptureWidth
, kVideoCaptureHeight
),
54 base::TimeDelta::FromMilliseconds(kVideoCaptureFrameDurationMs
),
59 scoped_refptr
<MediaStreamAudioRenderer
>
60 TestMediaStreamRendererFactory::GetAudioRenderer(const GURL
& url
,
61 int render_frame_id
) {
65 } // namespace content