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/renderer/media/mock_media_stream_video_sink.h"
7 #include "media/base/bind_to_current_loop.h"
11 MockMediaStreamVideoSink::MockMediaStreamVideoSink()
12 : number_of_frames_(0),
14 format_(media::VideoFrame::UNKNOWN
),
15 state_(blink::WebMediaStreamSource::ReadyStateLive
),
19 MockMediaStreamVideoSink::~MockMediaStreamVideoSink() {
22 VideoCaptureDeliverFrameCB
23 MockMediaStreamVideoSink::GetDeliverFrameCB() {
24 return media::BindToCurrentLoop(
26 &MockMediaStreamVideoSink::DeliverVideoFrame
,
27 weak_factory_
.GetWeakPtr()));
30 void MockMediaStreamVideoSink::DeliverVideoFrame(
31 const scoped_refptr
<media::VideoFrame
>& frame
,
32 const base::TimeTicks
& estimated_capture_time
) {
35 format_
= frame
->format();
36 frame_size_
= frame
->natural_size();
40 void MockMediaStreamVideoSink::OnReadyStateChanged(
41 blink::WebMediaStreamSource::ReadyState state
) {
45 void MockMediaStreamVideoSink::OnEnabledChanged(bool enabled
) {
49 } // namespace content