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

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

Issue 2518143004: [Mojo Video Capture] Replace RESOURCE_UTILIZATION with interface ReceiverLoadObserver (Closed)
Patch Set: Fix for android-only code Created 4 years 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_IMPL_H_ 5 #ifndef MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_BUFFER_POOL_IMPL_H_
6 #define MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_BUFFER_POOL_IMPL_H_ 6 #define MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_BUFFER_POOL_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 23 matching lines...) Expand all
34 std::unique_ptr<VideoCaptureBufferTrackerFactory> buffer_tracker_factory, 34 std::unique_ptr<VideoCaptureBufferTrackerFactory> buffer_tracker_factory,
35 int count); 35 int count);
36 36
37 // VideoCaptureBufferPool implementation. 37 // VideoCaptureBufferPool implementation.
38 mojo::ScopedSharedBufferHandle GetHandleForTransit(int buffer_id) override; 38 mojo::ScopedSharedBufferHandle GetHandleForTransit(int buffer_id) override;
39 std::unique_ptr<VideoCaptureBufferHandle> GetBufferHandle( 39 std::unique_ptr<VideoCaptureBufferHandle> GetBufferHandle(
40 int buffer_id) override; 40 int buffer_id) override;
41 int ReserveForProducer(const gfx::Size& dimensions, 41 int ReserveForProducer(const gfx::Size& dimensions,
42 media::VideoPixelFormat format, 42 media::VideoPixelFormat format,
43 media::VideoPixelStorage storage, 43 media::VideoPixelStorage storage,
44 int frame_feedback_id,
44 int* buffer_id_to_drop) override; 45 int* buffer_id_to_drop) override;
45 void RelinquishProducerReservation(int buffer_id) override; 46 void RelinquishProducerReservation(int buffer_id) override;
46 int ResurrectLastForProducer(const gfx::Size& dimensions, 47 int ResurrectLastForProducer(const gfx::Size& dimensions,
47 media::VideoPixelFormat format, 48 media::VideoPixelFormat format,
48 media::VideoPixelStorage storage) override; 49 media::VideoPixelStorage storage) override;
49 double GetBufferPoolUtilization() const override; 50 double GetBufferPoolUtilization() const override;
50 void HoldForConsumers(int buffer_id, int num_clients) override; 51 void HoldForConsumers(int buffer_id, int num_clients) override;
51 void RelinquishConsumerHold(int buffer_id, int num_clients) override; 52 void RelinquishConsumerHold(int buffer_id, int num_clients) override;
52 53
53 private: 54 private:
54 friend class base::RefCountedThreadSafe<VideoCaptureBufferPoolImpl>; 55 friend class base::RefCountedThreadSafe<VideoCaptureBufferPoolImpl>;
55 ~VideoCaptureBufferPoolImpl() override; 56 ~VideoCaptureBufferPoolImpl() override;
56 57
57 int ReserveForProducerInternal(const gfx::Size& dimensions, 58 int ReserveForProducerInternal(const gfx::Size& dimensions,
58 media::VideoPixelFormat format, 59 media::VideoPixelFormat format,
59 media::VideoPixelStorage storage, 60 media::VideoPixelStorage storage,
61 int frame_feedback_id,
60 int* tracker_id_to_drop); 62 int* tracker_id_to_drop);
61 63
62 VideoCaptureBufferTracker* GetTracker(int buffer_id); 64 VideoCaptureBufferTracker* GetTracker(int buffer_id);
63 65
64 // The max number of buffers that the pool is allowed to have at any moment. 66 // The max number of buffers that the pool is allowed to have at any moment.
65 const int count_; 67 const int count_;
66 68
67 // Protects everything below it. 69 // Protects everything below it.
68 mutable base::Lock lock_; 70 mutable base::Lock lock_;
69 71
70 // The ID of the next buffer. 72 // The ID of the next buffer.
71 int next_buffer_id_; 73 int next_buffer_id_;
72 74
73 // The ID of the buffer last relinquished by the producer (a candidate for 75 // The ID of the buffer last relinquished by the producer (a candidate for
74 // resurrection). 76 // resurrection).
75 int last_relinquished_buffer_id_; 77 int last_relinquished_buffer_id_;
76 78
77 // The buffers, indexed by the first parameter, a buffer id. 79 // The buffers, indexed by the first parameter, a buffer id.
78 std::map<int, std::unique_ptr<VideoCaptureBufferTracker>> trackers_; 80 std::map<int, std::unique_ptr<VideoCaptureBufferTracker>> trackers_;
79 81
80 const std::unique_ptr<VideoCaptureBufferTrackerFactory> 82 const std::unique_ptr<VideoCaptureBufferTrackerFactory>
81 buffer_tracker_factory_; 83 buffer_tracker_factory_;
82 84
83 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureBufferPoolImpl); 85 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureBufferPoolImpl);
84 }; 86 };
85 87
86 } // namespace media 88 } // namespace media
87 89
88 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_BUFFER_POOL_IMPL_H_ 90 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_BUFFER_POOL_IMPL_H_
OLDNEW
« no previous file with comments | « media/capture/video/video_capture_buffer_pool.h ('k') | media/capture/video/video_capture_buffer_pool_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698