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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 } | 116 } |
117 | 117 |
118 void SimulateOnBufferCreated(int buffer_id, const base::SharedMemory& shm) { | 118 void SimulateOnBufferCreated(int buffer_id, const base::SharedMemory& shm) { |
119 auto handle = base::SharedMemory::DuplicateHandle(shm.handle()); | 119 auto handle = base::SharedMemory::DuplicateHandle(shm.handle()); |
120 video_capture_impl_->OnBufferCreated( | 120 video_capture_impl_->OnBufferCreated( |
121 buffer_id, mojo::WrapSharedMemoryHandle(handle, shm.mapped_size(), | 121 buffer_id, mojo::WrapSharedMemoryHandle(handle, shm.mapped_size(), |
122 true /* read_only */)); | 122 true /* read_only */)); |
123 } | 123 } |
124 | 124 |
125 void SimulateBufferReceived(int buffer_id, const gfx::Size& size) { | 125 void SimulateBufferReceived(int buffer_id, const gfx::Size& size) { |
126 mojom::VideoFrameInfoPtr info = mojom::VideoFrameInfo::New(); | 126 media::mojom::VideoFrameInfoPtr info = media::mojom::VideoFrameInfo::New(); |
127 | 127 |
128 const base::TimeTicks now = base::TimeTicks::Now(); | 128 const base::TimeTicks now = base::TimeTicks::Now(); |
129 media::VideoFrameMetadata frame_metadata; | 129 media::VideoFrameMetadata frame_metadata; |
130 frame_metadata.SetTimeTicks(media::VideoFrameMetadata::REFERENCE_TIME, now); | 130 frame_metadata.SetTimeTicks(media::VideoFrameMetadata::REFERENCE_TIME, now); |
131 frame_metadata.MergeInternalValuesInto(&info->metadata); | 131 frame_metadata.MergeInternalValuesInto(&info->metadata); |
132 | 132 |
133 info->timestamp = now - base::TimeTicks(); | 133 info->timestamp = now - base::TimeTicks(); |
134 info->pixel_format = media::PIXEL_FORMAT_I420; | 134 info->pixel_format = media::PIXEL_FORMAT_I420; |
135 info->storage_type = media::PIXEL_STORAGE_CPU; | 135 info->storage_type = media::PIXEL_STORAGE_CPU; |
136 info->coded_size = size; | 136 info->coded_size = size; |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 EXPECT_CALL(mock_video_capture_host_, DoStart(_, kSessionId, params_small_)); | 335 EXPECT_CALL(mock_video_capture_host_, DoStart(_, kSessionId, params_small_)); |
336 | 336 |
337 StartCapture(0, params_small_); | 337 StartCapture(0, params_small_); |
338 | 338 |
339 OnStateChanged(mojom::VideoCaptureState::FAILED); | 339 OnStateChanged(mojom::VideoCaptureState::FAILED); |
340 | 340 |
341 StopCapture(0); | 341 StopCapture(0); |
342 } | 342 } |
343 | 343 |
344 } // namespace content | 344 } // namespace content |
OLD | NEW |