diff options
author | wjia@chromium.org <wjia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-06 22:19:21 +0000 |
---|---|---|
committer | wjia@chromium.org <wjia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-06 22:19:21 +0000 |
commit | 73347bf7467d72c84997473489b5ab48e1c41a19 (patch) | |
tree | 7d234de80c0fc2e3a4e20ca82e487b2eb57cefa3 /webkit/support/test_media_stream_client.cc | |
parent | c694427c13725a8d73303fbe2c47e8cbd6abd6c3 (diff) | |
download | chromium_src-73347bf7467d72c84997473489b5ab48e1c41a19.zip chromium_src-73347bf7467d72c84997473489b5ab48e1c41a19.tar.gz chromium_src-73347bf7467d72c84997473489b5ab48e1c41a19.tar.bz2 |
add components for integration test which will detect breakage of media pipeline with video capture as video decoder.
This patch does NOT depend on the WebKit patch (https://bugs.webkit.org/show_bug.cgi?id=74882) any longer, since a utility class MediaStreamUtil has been added in webkit_support. On the opposite, that WebKit patch depends on this one.
There are 2 API's for webkit_support::CreateMediaPlayer in order to be backward compatible with WebKit. Once WebKit patch is landed, the old API (with 2 arguments) can be removed.
In that WebKit patch, WebViewHost uses WebKit::WebUserMediaClientMock to return a userMediaClient.
A mocked webkit_media::MediaStreamClient is used in webkit_support::CreateMediaPlayer.
BUG=none
TEST=run video-capture-preview.html
Review URL: http://codereview.chromium.org/8887004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116749 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/support/test_media_stream_client.cc')
-rw-r--r-- | webkit/support/test_media_stream_client.cc | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/webkit/support/test_media_stream_client.cc b/webkit/support/test_media_stream_client.cc new file mode 100644 index 0000000..4ca3e81 --- /dev/null +++ b/webkit/support/test_media_stream_client.cc @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "webkit/support/test_media_stream_client.h" + +#include "googleurl/src/gurl.h" +#include "media/base/message_loop_factory.h" +#include "media/base/pipeline.h" +#include "media/filters/video_frame_generator.h" + +namespace { + +static const int kVideoCaptureWidth = 352; +static const int kVideoCaptureHeight = 288; +static const int kVideoCaptureFrameDurationMs = 33; + +} // namespace + +namespace webkit_support { + +TestMediaStreamClient::TestMediaStreamClient(MediaStreamUtil* media_stream_util) + : media_stream_util_(media_stream_util) { +} + +scoped_refptr<media::VideoDecoder> TestMediaStreamClient::GetVideoDecoder( + const GURL& url, media::MessageLoopFactory* message_loop_factory) { + if (!media_stream_util_ || !media_stream_util_->IsMockStream(url)) + return NULL; + + return new media::VideoFrameGenerator( + message_loop_factory->GetMessageLoopProxy("CaptureVideoDecoder").get(), + gfx::Size(kVideoCaptureWidth, kVideoCaptureHeight), + base::TimeDelta::FromMilliseconds(kVideoCaptureFrameDurationMs)); +} + +} // namespace webkit_support |