OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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. |
| 4 |
| 5 #include "webkit/support/test_media_stream_client.h" |
| 6 |
| 7 #include "googleurl/src/gurl.h" |
| 8 #include "media/base/message_loop_factory.h" |
| 9 #include "media/base/pipeline.h" |
| 10 #include "media/video/capture/fake_capture_video_decoder.h" |
| 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebUserMediaClientMoc
k.h" |
| 12 |
| 13 namespace { |
| 14 |
| 15 static const int kVideoCaptureWidth = 352; |
| 16 static const int kVideoCaptureHeight = 288; |
| 17 static const int kVideoCaptureFramePerSecond = 30; |
| 18 |
| 19 } // namespace |
| 20 |
| 21 namespace webkit_support { |
| 22 |
| 23 TestMediaStreamClient::TestMediaStreamClient( |
| 24 WebKit::WebUserMediaClientMock* userMediaClientMock) |
| 25 : m_userMediaClientMock(userMediaClientMock) { |
| 26 } |
| 27 |
| 28 scoped_refptr<media::VideoDecoder> TestMediaStreamClient::GetVideoDecoder( |
| 29 const GURL& url, media::MessageLoopFactory* message_loop_factory) { |
| 30 if (!m_userMediaClientMock) |
| 31 return NULL; |
| 32 |
| 33 bool raw_media = m_userMediaClientMock->isStream(url); |
| 34 media::VideoDecoder* decoder = NULL; |
| 35 if (raw_media) { |
| 36 media::VideoCapture::VideoCaptureCapability capability; |
| 37 capability.width = kVideoCaptureWidth; |
| 38 capability.height = kVideoCaptureHeight; |
| 39 capability.max_fps = kVideoCaptureFramePerSecond; |
| 40 capability.expected_capture_delay = 0; |
| 41 capability.raw_type = media::VideoFrame::I420; |
| 42 capability.interlaced = false; |
| 43 |
| 44 decoder = new media::FakeCaptureVideoDecoder( |
| 45 message_loop_factory->GetMessageLoopProxy("CaptureVideoDecoder").get(), |
| 46 capability); |
| 47 } |
| 48 return decoder; |
| 49 } |
| 50 |
| 51 } // namespace webkit_support |
OLD | NEW |