Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: media/capture/video/video_capture_buffer_pool.h

Issue 2410383002: VideoCapture: more migration IPC-->mojo, part 6 (Closed)
Patch Set: Comment correction Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_BUFFER_POOL_H_ 5 #ifndef MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_BUFFER_POOL_H_
6 #define MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_BUFFER_POOL_H_ 6 #define MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_BUFFER_POOL_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "media/base/video_capture_types.h" 9 #include "media/base/video_capture_types.h"
10 #include "media/capture/capture_export.h" 10 #include "media/capture/capture_export.h"
11 #include "mojo/public/cpp/system/buffer.h"
11 #include "ui/gfx/geometry/size.h" 12 #include "ui/gfx/geometry/size.h"
12 #include "ui/gfx/gpu_memory_buffer.h" 13 #include "ui/gfx/gpu_memory_buffer.h"
13 14
14 namespace media { 15 namespace media {
15 16
16 class VideoCaptureBufferHandle; 17 class VideoCaptureBufferHandle;
17 18
18 // A thread-safe class that does the bookkeeping and lifetime management for a 19 // A thread-safe class that does the bookkeeping and lifetime management for a
19 // pool of pixel buffers cycled between an in-process producer (e.g. a 20 // pool of pixel buffers cycled between an in-process producer (e.g. a
20 // VideoCaptureDevice) and a set of out-of-process consumers. The pool is 21 // VideoCaptureDevice) and a set of out-of-process consumers. The pool is
(...skipping 12 matching lines...) Expand all
33 // called |buffer_id|. -1 (kInvalidId) is never a valid ID, and is returned by 34 // called |buffer_id|. -1 (kInvalidId) is never a valid ID, and is returned by
34 // some methods to indicate failure. The active set of buffer ids may change 35 // some methods to indicate failure. The active set of buffer ids may change
35 // over the lifetime of the buffer pool, as existing buffers are freed and 36 // over the lifetime of the buffer pool, as existing buffers are freed and
36 // reallocated at larger size. When reallocation occurs, new buffer IDs will 37 // reallocated at larger size. When reallocation occurs, new buffer IDs will
37 // circulate. 38 // circulate.
38 class CAPTURE_EXPORT VideoCaptureBufferPool 39 class CAPTURE_EXPORT VideoCaptureBufferPool
39 : public base::RefCountedThreadSafe<VideoCaptureBufferPool> { 40 : public base::RefCountedThreadSafe<VideoCaptureBufferPool> {
40 public: 41 public:
41 static constexpr int kInvalidId = -1; 42 static constexpr int kInvalidId = -1;
42 43
43 // One-time (per client/per-buffer) initialization to share a particular 44 // One-time (per client/per-buffer) call to allow sharing |buffer_id|.
44 // buffer to a process. The shared handle is returned as |new_handle|. 45 virtual mojo::ScopedSharedBufferHandle GetHandleForTransit(int buffer_id) = 0;
45 virtual bool ShareToProcess(int buffer_id,
46 base::ProcessHandle process_handle,
47 base::SharedMemoryHandle* new_handle) = 0;
48 46
49 // Try and obtain a BufferHandle for |buffer_id|. 47 // Try and obtain a BufferHandle for |buffer_id|.
50 virtual std::unique_ptr<VideoCaptureBufferHandle> GetBufferHandle( 48 virtual std::unique_ptr<VideoCaptureBufferHandle> GetBufferHandle(
51 int buffer_id) = 0; 49 int buffer_id) = 0;
52 50
53 // Reserve or allocate a buffer to support a packed frame of |dimensions| of 51 // Reserve or allocate a buffer to support a packed frame of |dimensions| of
54 // pixel |format| and return its id. This will fail (returning kInvalidId) if 52 // pixel |format| and return its id. This will fail (returning kInvalidId) if
55 // the pool already is at its |count| limit of the number of allocations, and 53 // the pool already is at its |count| limit of the number of allocations, and
56 // all allocated buffers are in use by the producer and/or consumers. 54 // all allocated buffers are in use by the producer and/or consumers.
57 // 55 //
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 protected: 100 protected:
103 virtual ~VideoCaptureBufferPool() {} 101 virtual ~VideoCaptureBufferPool() {}
104 102
105 private: 103 private:
106 friend class base::RefCountedThreadSafe<VideoCaptureBufferPool>; 104 friend class base::RefCountedThreadSafe<VideoCaptureBufferPool>;
107 }; 105 };
108 106
109 } // namespace media 107 } // namespace media
110 108
111 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_BUFFER_POOL_H_ 109 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_BUFFER_POOL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698