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

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

Issue 2583603002: [Mojo Video Capture] Split OnIncomingCapturedVideoFrame() to OnNewBuffer() + OnFrameReadyInBuffer() (Closed)
Patch Set: Improve naming and fix Android background issue 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 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
11 #include <memory> 11 #include <memory>
12 #include <set>
12 13
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
15 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/threading/thread_collision_warner.h"
16 #include "media/capture/capture_export.h" 18 #include "media/capture/capture_export.h"
17 #include "media/capture/video/video_capture_device.h" 19 #include "media/capture/video/video_capture_device.h"
18 20
19 namespace media { 21 namespace media {
20 class VideoCaptureBufferPool; 22 class VideoCaptureBufferPool;
21 class VideoFrameReceiver; 23 class VideoFrameReceiver;
22 class VideoCaptureJpegDecoder; 24 class VideoCaptureJpegDecoder;
23 25
24 using VideoCaptureJpegDecoderFactoryCB = 26 using VideoCaptureJpegDecoderFactoryCB =
25 base::Callback<std::unique_ptr<VideoCaptureJpegDecoder>()>; 27 base::Callback<std::unique_ptr<VideoCaptureJpegDecoder>()>;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // A branch of OnIncomingCapturedData for Y16 frame_format.pixel_format. 98 // A branch of OnIncomingCapturedData for Y16 frame_format.pixel_format.
97 void OnIncomingCapturedY16Data(const uint8_t* data, 99 void OnIncomingCapturedY16Data(const uint8_t* data,
98 int length, 100 int length,
99 const VideoCaptureFormat& frame_format, 101 const VideoCaptureFormat& frame_format,
100 base::TimeTicks reference_time, 102 base::TimeTicks reference_time,
101 base::TimeDelta timestamp, 103 base::TimeDelta timestamp,
102 int frame_feedback_id); 104 int frame_feedback_id);
103 105
104 // The receiver to which we post events. 106 // The receiver to which we post events.
105 const std::unique_ptr<VideoFrameReceiver> receiver_; 107 const std::unique_ptr<VideoFrameReceiver> receiver_;
108 std::set<int> buffer_ids_known_by_receiver_;
106 109
107 const VideoCaptureJpegDecoderFactoryCB jpeg_decoder_factory_callback_; 110 const VideoCaptureJpegDecoderFactoryCB jpeg_decoder_factory_callback_;
108 std::unique_ptr<VideoCaptureJpegDecoder> external_jpeg_decoder_; 111 std::unique_ptr<VideoCaptureJpegDecoder> external_jpeg_decoder_;
109 112
110 // Whether |external_jpeg_decoder_| has been initialized. 113 // Whether |external_jpeg_decoder_| has been initialized.
111 bool external_jpeg_decoder_initialized_; 114 bool external_jpeg_decoder_initialized_;
112 115
113 // The pool of shared-memory buffers used for capturing. 116 // The pool of shared-memory buffers used for capturing.
114 const scoped_refptr<VideoCaptureBufferPool> buffer_pool_; 117 const scoped_refptr<VideoCaptureBufferPool> buffer_pool_;
115 118
116 #if DCHECK_IS_ON() 119 #if DCHECK_IS_ON()
117 // Counter used to track the number of times consecutive capture buffers are 120 // Counter used to track the number of times consecutive capture buffers are
118 // dropped. 121 // dropped.
119 int dropped_frame_counter_ = 0; 122 int dropped_frame_counter_ = 0;
120 123
121 static const int kMaxDroppedFrames = 150; 124 static const int kMaxDroppedFrames = 150;
122 #endif // DCHECK_IS_ON() 125 #endif // DCHECK_IS_ON()
123 126
124 media::VideoPixelFormat last_captured_pixel_format_; 127 media::VideoPixelFormat last_captured_pixel_format_;
125 128
129 // Thread collision warner to ensure that producer-facing API is not called
130 // concurrently. Producers are allowed to call from multiple threads, but not
131 // concurrently.
132 DFAKE_MUTEX(call_from_producer_);
133
126 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceClient); 134 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceClient);
127 }; 135 };
128 136
129 } // namespace media 137 } // namespace media
130 138
131 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_ 139 #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