Add signalSyncPoint to the WebGraphicsContext3D command buffer impls.
[chromium-blink-merge.git] / webkit / support / test_media_stream_client.cc
blobcd729b4a9067e9f8cf5637be4f2da886cff35669
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
3 // found in the LICENSE file.
5 #include "webkit/support/test_media_stream_client.h"
7 #include "googleurl/src/gurl.h"
8 #include "media/base/pipeline.h"
9 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStream.h"
10 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamTrack.h"
11 #include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaStreamRegistry.h"
13 #include "webkit/media/media_stream_audio_renderer.h"
14 #include "webkit/media/simple_video_frame_provider.h"
16 using namespace WebKit;
18 namespace {
20 static const int kVideoCaptureWidth = 352;
21 static const int kVideoCaptureHeight = 288;
22 static const int kVideoCaptureFrameDurationMs = 33;
24 bool IsMockMediaStreamWithVideo(const WebURL& url) {
25 WebMediaStream descriptor(
26 WebMediaStreamRegistry::lookupMediaStreamDescriptor(url));
27 if (descriptor.isNull())
28 return false;
29 WebVector<WebMediaStreamTrack> videoSources;
30 descriptor.videoSources(videoSources);
31 return videoSources.size() > 0;
34 } // namespace
36 namespace webkit_support {
38 TestMediaStreamClient::TestMediaStreamClient() {}
40 TestMediaStreamClient::~TestMediaStreamClient() {}
42 bool TestMediaStreamClient::IsMediaStream(const GURL& url) {
43 return IsMockMediaStreamWithVideo(url);
46 scoped_refptr<webkit_media::VideoFrameProvider>
47 TestMediaStreamClient::GetVideoFrameProvider(
48 const GURL& url,
49 const base::Closure& error_cb,
50 const webkit_media::VideoFrameProvider::RepaintCB& repaint_cb) {
51 if (!IsMockMediaStreamWithVideo(url))
52 return NULL;
54 return new webkit_media::SimpleVideoFrameProvider(
55 gfx::Size(kVideoCaptureWidth, kVideoCaptureHeight),
56 base::TimeDelta::FromMilliseconds(kVideoCaptureFrameDurationMs),
57 error_cb,
58 repaint_cb);
61 scoped_refptr<webkit_media::MediaStreamAudioRenderer>
62 TestMediaStreamClient::GetAudioRenderer(const GURL& url) {
63 return NULL;
66 } // namespace webkit_support