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

Side by Side Diff: media/capture/video/video_capture_device_client.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_DEVICE_CLIENT_H_ 5 #ifndef MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_
6 #define MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_ 6 #define MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 scoped_refptr<VideoCaptureBufferPool> buffer_pool, 48 scoped_refptr<VideoCaptureBufferPool> buffer_pool,
49 const VideoCaptureJpegDecoderFactoryCB& jpeg_decoder_factory); 49 const VideoCaptureJpegDecoderFactoryCB& jpeg_decoder_factory);
50 ~VideoCaptureDeviceClient() override; 50 ~VideoCaptureDeviceClient() override;
51 51
52 // VideoCaptureDevice::Client implementation. 52 // VideoCaptureDevice::Client implementation.
53 void OnIncomingCapturedData(const uint8_t* data, 53 void OnIncomingCapturedData(const uint8_t* data,
54 int length, 54 int length,
55 const media::VideoCaptureFormat& frame_format, 55 const media::VideoCaptureFormat& frame_format,
56 int rotation, 56 int rotation,
57 base::TimeTicks reference_time, 57 base::TimeTicks reference_time,
58 base::TimeDelta timestamp) override; 58 base::TimeDelta timestamp,
59 std::unique_ptr<Buffer> ReserveOutputBuffer( 59 int frame_feedback_id = 0) override;
60 const gfx::Size& dimensions, 60 std::unique_ptr<Buffer> ReserveOutputBuffer(const gfx::Size& dimensions,
61 media::VideoPixelFormat format, 61 media::VideoPixelFormat format,
62 media::VideoPixelStorage storage) override; 62 media::VideoPixelStorage storage,
63 int frame_feedback_id) override;
63 void OnIncomingCapturedBuffer(std::unique_ptr<Buffer> buffer, 64 void OnIncomingCapturedBuffer(std::unique_ptr<Buffer> buffer,
64 const media::VideoCaptureFormat& frame_format, 65 const VideoCaptureFormat& format,
65 base::TimeTicks reference_time, 66 base::TimeTicks reference_time,
66 base::TimeDelta timestamp) override; 67 base::TimeDelta timestamp) override;
67 void OnIncomingCapturedVideoFrame( 68 void OnIncomingCapturedVideoFrame(
68 std::unique_ptr<Buffer> buffer, 69 std::unique_ptr<Buffer> buffer,
69 scoped_refptr<media::VideoFrame> frame) override; 70 scoped_refptr<media::VideoFrame> frame) override;
70 std::unique_ptr<Buffer> ResurrectLastOutputBuffer( 71 std::unique_ptr<Buffer> ResurrectLastOutputBuffer(
71 const gfx::Size& dimensions, 72 const gfx::Size& dimensions,
72 media::VideoPixelFormat format, 73 media::VideoPixelFormat format,
73 media::VideoPixelStorage storage) override; 74 media::VideoPixelStorage storage,
75 int new_frame_feedback_id) override;
74 void OnError(const tracked_objects::Location& from_here, 76 void OnError(const tracked_objects::Location& from_here,
75 const std::string& reason) override; 77 const std::string& reason) override;
76 void OnLog(const std::string& message) override; 78 void OnLog(const std::string& message) override;
77 double GetBufferPoolUtilization() const override; 79 double GetBufferPoolUtilization() const override;
78 80
79 private: 81 private:
80 // Reserve output buffer into which I420 contents can be copied directly. 82 // Reserve output buffer into which I420 contents can be copied directly.
81 // The dimensions of the frame is described by |dimensions|, and requested 83 // The dimensions of the frame is described by |dimensions|, and requested
82 // output buffer format is specified by |storage|. The reserved output buffer 84 // output buffer format is specified by |storage|. The reserved output buffer
83 // is returned; and the pointer to Y plane is stored at [y_plane_data], U 85 // is returned; and the pointer to Y plane is stored at [y_plane_data], U
84 // plane is stored at [u_plane_data], V plane is stored at [v_plane_data]. 86 // plane is stored at [u_plane_data], V plane is stored at [v_plane_data].
85 // Returns an nullptr if allocation fails. 87 // Returns an nullptr if allocation fails.
86 // 88 //
87 // When requested |storage| is PIXEL_STORAGE_CPU, a single shared memory 89 // When requested |storage| is PIXEL_STORAGE_CPU, a single shared memory
88 // chunk is reserved. The output buffers stay reserved and mapped for use 90 // chunk is reserved. The output buffers stay reserved and mapped for use
89 // until the Buffer objects are destroyed or returned. 91 // until the Buffer objects are destroyed or returned.
90 std::unique_ptr<Buffer> ReserveI420OutputBuffer( 92 std::unique_ptr<Buffer> ReserveI420OutputBuffer(
91 const gfx::Size& dimensions, 93 const gfx::Size& dimensions,
92 media::VideoPixelStorage storage, 94 media::VideoPixelStorage storage,
95 int frame_feedback_id,
93 uint8_t** y_plane_data, 96 uint8_t** y_plane_data,
94 uint8_t** u_plane_data, 97 uint8_t** u_plane_data,
95 uint8_t** v_plane_data); 98 uint8_t** v_plane_data);
96 99
97 // A branch of OnIncomingCapturedData for Y16 frame_format.pixel_format. 100 // A branch of OnIncomingCapturedData for Y16 frame_format.pixel_format.
98 void OnIncomingCapturedY16Data(const uint8_t* data, 101 void OnIncomingCapturedY16Data(const uint8_t* data,
99 int length, 102 int length,
100 const VideoCaptureFormat& frame_format, 103 const VideoCaptureFormat& frame_format,
101 base::TimeTicks reference_time, 104 base::TimeTicks reference_time,
102 base::TimeDelta timestamp); 105 base::TimeDelta timestamp,
106 int frame_feedback_id);
103 107
104 // The receiver to which we post events. 108 // The receiver to which we post events.
105 const std::unique_ptr<VideoFrameReceiver> receiver_; 109 const std::unique_ptr<VideoFrameReceiver> receiver_;
106 110
107 const VideoCaptureJpegDecoderFactoryCB jpeg_decoder_factory_callback_; 111 const VideoCaptureJpegDecoderFactoryCB jpeg_decoder_factory_callback_;
108 std::unique_ptr<VideoCaptureJpegDecoder> external_jpeg_decoder_; 112 std::unique_ptr<VideoCaptureJpegDecoder> external_jpeg_decoder_;
109 113
110 // Whether |external_jpeg_decoder_| has been initialized. 114 // Whether |external_jpeg_decoder_| has been initialized.
111 bool external_jpeg_decoder_initialized_; 115 bool external_jpeg_decoder_initialized_;
112 116
113 // The pool of shared-memory buffers used for capturing. 117 // The pool of shared-memory buffers used for capturing.
114 const scoped_refptr<VideoCaptureBufferPool> buffer_pool_; 118 const scoped_refptr<VideoCaptureBufferPool> buffer_pool_;
115 119
116 #if DCHECK_IS_ON() 120 #if DCHECK_IS_ON()
117 // Counter used to track the number of times consecutive capture buffers are 121 // Counter used to track the number of times consecutive capture buffers are
118 // dropped. 122 // dropped.
119 int dropped_frame_counter_ = 0; 123 int dropped_frame_counter_ = 0;
120 124
121 static const int kMaxDroppedFrames = 150; 125 static const int kMaxDroppedFrames = 150;
122 #endif // DCHECK_IS_ON() 126 #endif // DCHECK_IS_ON()
123 127
124 media::VideoPixelFormat last_captured_pixel_format_; 128 media::VideoPixelFormat last_captured_pixel_format_;
125 129
126 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceClient); 130 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceClient);
127 }; 131 };
128 132
129 } // namespace media 133 } // namespace media
130 134
131 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_ 135 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_
OLDNEW
« no previous file with comments | « media/capture/video/video_capture_device.h ('k') | media/capture/video/video_capture_device_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698