OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "content/child/child_process.h" | 10 #include "content/child/child_process.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 buffer_id, mojo::WrapSharedMemoryHandle(handle, shm.mapped_size(), | 129 buffer_id, mojo::WrapSharedMemoryHandle(handle, shm.mapped_size(), |
130 true /* read_only */)); | 130 true /* read_only */)); |
131 } | 131 } |
132 | 132 |
133 void SimulateBufferReceived(int buffer_id, const gfx::Size& size) { | 133 void SimulateBufferReceived(int buffer_id, const gfx::Size& size) { |
134 media::mojom::VideoFrameInfoPtr info = media::mojom::VideoFrameInfo::New(); | 134 media::mojom::VideoFrameInfoPtr info = media::mojom::VideoFrameInfo::New(); |
135 | 135 |
136 const base::TimeTicks now = base::TimeTicks::Now(); | 136 const base::TimeTicks now = base::TimeTicks::Now(); |
137 media::VideoFrameMetadata frame_metadata; | 137 media::VideoFrameMetadata frame_metadata; |
138 frame_metadata.SetTimeTicks(media::VideoFrameMetadata::REFERENCE_TIME, now); | 138 frame_metadata.SetTimeTicks(media::VideoFrameMetadata::REFERENCE_TIME, now); |
139 info->metadata = frame_metadata.CopyInternalValues(); | 139 info->metadata = frame_metadata.GetInternalValues(); |
140 | 140 |
141 info->timestamp = now - base::TimeTicks(); | 141 info->timestamp = now - base::TimeTicks(); |
142 info->pixel_format = media::PIXEL_FORMAT_I420; | 142 info->pixel_format = media::PIXEL_FORMAT_I420; |
143 info->storage_type = media::PIXEL_STORAGE_CPU; | 143 info->storage_type = media::PIXEL_STORAGE_CPU; |
144 info->coded_size = size; | 144 info->coded_size = size; |
145 info->visible_rect = gfx::Rect(size); | 145 info->visible_rect = gfx::Rect(size); |
146 | 146 |
147 video_capture_impl_->OnBufferReady(buffer_id, std::move(info)); | 147 video_capture_impl_->OnBufferReady(buffer_id, std::move(info)); |
148 } | 148 } |
149 | 149 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 EXPECT_CALL(*this, OnStateUpdate(VIDEO_CAPTURE_STATE_STARTED)); | 377 EXPECT_CALL(*this, OnStateUpdate(VIDEO_CAPTURE_STATE_STARTED)); |
378 EXPECT_CALL(mock_video_capture_host_, RequestRefreshFrame(_)); | 378 EXPECT_CALL(mock_video_capture_host_, RequestRefreshFrame(_)); |
379 video_capture_impl_->OnStateChanged(mojom::VideoCaptureState::STARTED); | 379 video_capture_impl_->OnStateChanged(mojom::VideoCaptureState::STARTED); |
380 | 380 |
381 EXPECT_CALL(*this, OnStateUpdate(VIDEO_CAPTURE_STATE_STOPPED)); | 381 EXPECT_CALL(*this, OnStateUpdate(VIDEO_CAPTURE_STATE_STOPPED)); |
382 EXPECT_CALL(mock_video_capture_host_, Stop(_)); | 382 EXPECT_CALL(mock_video_capture_host_, Stop(_)); |
383 StopCapture(0); | 383 StopCapture(0); |
384 } | 384 } |
385 | 385 |
386 } // namespace content | 386 } // namespace content |
OLD | NEW |