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

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

Issue 2573223002: [Mojo Video Capture] Simplify media::VideoCaptureDevice::Client:Buffer to a struct (Closed)
Patch Set: mcasas comments Created 3 years, 11 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_CAPTURE_VIDEO_VIDEO_CAPTURE_BUFFER_POOL_H_ 5 #ifndef MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_BUFFER_POOL_H_
6 #define MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_BUFFER_POOL_H_ 6 #define MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_BUFFER_POOL_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "media/capture/capture_export.h" 9 #include "media/capture/capture_export.h"
10 #include "media/capture/video_capture_types.h" 10 #include "media/capture/video_capture_types.h"
(...skipping 24 matching lines...) Expand all
35 // 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
36 // 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
37 // reallocated at larger size. When reallocation occurs, new buffer IDs will 37 // reallocated at larger size. When reallocation occurs, new buffer IDs will
38 // circulate. 38 // circulate.
39 class CAPTURE_EXPORT VideoCaptureBufferPool 39 class CAPTURE_EXPORT VideoCaptureBufferPool
40 : public base::RefCountedThreadSafe<VideoCaptureBufferPool> { 40 : public base::RefCountedThreadSafe<VideoCaptureBufferPool> {
41 public: 41 public:
42 static constexpr int kInvalidId = -1; 42 static constexpr int kInvalidId = -1;
43 43
44 // One-time (per client/per-buffer) call to allow sharing |buffer_id|. 44 // One-time (per client/per-buffer) call to allow sharing |buffer_id|.
45 virtual mojo::ScopedSharedBufferHandle GetHandleForTransit(int buffer_id) = 0; 45 virtual mojo::ScopedSharedBufferHandle GetHandleForInterProcessTransit(
46 int buffer_id) = 0;
46 47
47 // Try and obtain a BufferHandle for |buffer_id|. 48 // Try and obtain a read/write access to the buffer.
48 virtual std::unique_ptr<VideoCaptureBufferHandle> GetBufferHandle( 49 virtual std::unique_ptr<VideoCaptureBufferHandle> GetHandleForInProcessAccess(
49 int buffer_id) = 0; 50 int buffer_id) = 0;
50 51
51 // Reserve or allocate a buffer to support a packed frame of |dimensions| of 52 // Reserve or allocate a buffer to support a packed frame of |dimensions| of
52 // pixel |format| and return its id. This will fail (returning kInvalidId) if 53 // pixel |format| and return its id. This will fail (returning kInvalidId) if
53 // the pool already is at its |count| limit of the number of allocations, and 54 // the pool already is at its |count| limit of the number of allocations, and
54 // all allocated buffers are in use by the producer and/or consumers. 55 // all allocated buffers are in use by the producer and/or consumers.
55 // 56 //
56 // If successful, the reserved buffer remains reserved (and writable by the 57 // If successful, the reserved buffer remains reserved (and writable by the
57 // producer) until ownership is transferred either to the consumer via 58 // producer) until ownership is transferred either to the consumer via
58 // HoldForConsumers(), or back to the pool with 59 // HoldForConsumers(), or back to the pool with
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 protected: 102 protected:
102 virtual ~VideoCaptureBufferPool() {} 103 virtual ~VideoCaptureBufferPool() {}
103 104
104 private: 105 private:
105 friend class base::RefCountedThreadSafe<VideoCaptureBufferPool>; 106 friend class base::RefCountedThreadSafe<VideoCaptureBufferPool>;
106 }; 107 };
107 108
108 } // namespace media 109 } // namespace media
109 110
110 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_BUFFER_POOL_H_ 111 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_BUFFER_POOL_H_
OLDNEW
« no previous file with comments | « media/capture/video/video_capture_buffer_handle.h ('k') | media/capture/video/video_capture_buffer_pool_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698