| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/media/mock_media_stream_video_source.h" | 5 #include "content/renderer/media/mock_media_stream_video_source.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 | 10 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 return; | 85 return; |
| 86 } | 86 } |
| 87 callback.Run(supported_formats_); | 87 callback.Run(supported_formats_); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void MockMediaStreamVideoSource::StartSourceImpl( | 90 void MockMediaStreamVideoSource::StartSourceImpl( |
| 91 const media::VideoCaptureFormat& format, | 91 const media::VideoCaptureFormat& format, |
| 92 const blink::WebMediaConstraints& constraints, | 92 const blink::WebMediaConstraints& constraints, |
| 93 const VideoCaptureDeliverFrameCB& frame_callback) { | 93 const VideoCaptureDeliverFrameCB& frame_callback) { |
| 94 DCHECK(frame_callback_.is_null()); | 94 DCHECK(frame_callback_.is_null()); |
| 95 if (IsOldVideoConstraints()) | |
| 96 format_ = format; | |
| 97 | |
| 98 attempted_to_start_ = true; | 95 attempted_to_start_ = true; |
| 99 frame_callback_ = frame_callback; | 96 frame_callback_ = frame_callback; |
| 100 } | 97 } |
| 101 | 98 |
| 102 void MockMediaStreamVideoSource::StopSourceImpl() { | 99 void MockMediaStreamVideoSource::StopSourceImpl() { |
| 103 } | 100 } |
| 104 | 101 |
| 105 base::Optional<media::VideoCaptureFormat> | 102 base::Optional<media::VideoCaptureFormat> |
| 106 MockMediaStreamVideoSource::GetCurrentFormatImpl() const { | 103 MockMediaStreamVideoSource::GetCurrentFormatImpl() const { |
| 107 return base::Optional<media::VideoCaptureFormat>(format_); | 104 return base::Optional<media::VideoCaptureFormat>(format_); |
| 108 } | 105 } |
| 109 | 106 |
| 110 void MockMediaStreamVideoSource::DeliverVideoFrame( | 107 void MockMediaStreamVideoSource::DeliverVideoFrame( |
| 111 const scoped_refptr<media::VideoFrame>& frame) { | 108 const scoped_refptr<media::VideoFrame>& frame) { |
| 112 DCHECK(!frame_callback_.is_null()); | 109 DCHECK(!frame_callback_.is_null()); |
| 113 io_task_runner()->PostTask( | 110 io_task_runner()->PostTask( |
| 114 FROM_HERE, base::Bind(frame_callback_, frame, base::TimeTicks())); | 111 FROM_HERE, base::Bind(frame_callback_, frame, base::TimeTicks())); |
| 115 } | 112 } |
| 116 | 113 |
| 117 } // namespace content | 114 } // namespace content |
| OLD | NEW |