OLD | NEW |
(Empty) | |
| 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. |
| 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/filters/video_frame_generator.h" |
| 11 |
| 12 namespace { |
| 13 |
| 14 static const int kVideoCaptureWidth = 352; |
| 15 static const int kVideoCaptureHeight = 288; |
| 16 static const int kVideoCaptureFrameDurationMs = 33; |
| 17 |
| 18 } // namespace |
| 19 |
| 20 namespace webkit_support { |
| 21 |
| 22 TestMediaStreamClient::TestMediaStreamClient(MediaStreamUtil* media_stream_util) |
| 23 : media_stream_util_(media_stream_util) { |
| 24 } |
| 25 |
| 26 scoped_refptr<media::VideoDecoder> TestMediaStreamClient::GetVideoDecoder( |
| 27 const GURL& url, media::MessageLoopFactory* message_loop_factory) { |
| 28 if (!media_stream_util_) |
| 29 return NULL; |
| 30 |
| 31 bool raw_media = media_stream_util_->IsMockStream(url); |
| 32 media::VideoDecoder* decoder = NULL; |
| 33 if (raw_media) { |
| 34 gfx::Size size(kVideoCaptureWidth, kVideoCaptureHeight); |
| 35 base::TimeDelta frame_duration = |
| 36 base::TimeDelta::FromMilliseconds(kVideoCaptureFrameDurationMs); |
| 37 |
| 38 decoder = new media::VideoFrameGenerator( |
| 39 message_loop_factory->GetMessageLoopProxy("CaptureVideoDecoder").get(), |
| 40 size, frame_duration); |
| 41 } |
| 42 return decoder; |
| 43 } |
| 44 |
| 45 } // namespace webkit_support |
OLD | NEW |