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

Unified Diff: content/browser/renderer_host/media/video_capture_device_client.h

Issue 1016773002: MJPEG acceleration for video capture using VAAPI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix coded size, shm handle Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/video_capture_device_client.h
diff --git a/content/browser/renderer_host/media/video_capture_device_client.h b/content/browser/renderer_host/media/video_capture_device_client.h
index 6d73f0c95ca0b4df47769ad904c5eb7cb06e74e6..de118d46d3698120643a6731c3aaab79293843ee 100644
--- a/content/browser/renderer_host/media/video_capture_device_client.h
+++ b/content/browser/renderer_host/media/video_capture_device_client.h
@@ -10,11 +10,26 @@
#include "base/memory/weak_ptr.h"
#include "content/common/content_export.h"
#include "media/video/capture/video_capture_device.h"
+#include "media/video/jpeg_decode_accelerator.h"
+
+namespace base {
+class WaitableEvent;
+} // namespace base
namespace content {
class VideoCaptureBufferPool;
class VideoCaptureController;
+struct CapturedData {
+ const uint8* data;
+ int length;
+ media::VideoCaptureFormat frame_format;
+ int rotation;
+ base::TimeTicks timestamp;
+ scoped_refptr<media::VideoFrame> frame;
+ scoped_refptr<media::VideoCaptureDevice::Client::Buffer> buffer;
+};
+
// Receives events from the VideoCaptureDevice and posts them to a |controller_|
// on the IO thread. An instance of this class may safely outlive its target
// VideoCaptureController. This is a shallow class meant to convert incoming
@@ -25,7 +40,8 @@ class VideoCaptureController;
// device type; including, for example, the DirectShow thread on Windows, the
// v4l2_thread on Linux, and the UI thread for tab capture.
class CONTENT_EXPORT VideoCaptureDeviceClient
- : public media::VideoCaptureDevice::Client {
+ : public media::VideoCaptureDevice::Client,
+ public media::JpegDecodeAccelerator::Client {
public:
VideoCaptureDeviceClient(
const base::WeakPtr<VideoCaptureController>& controller,
@@ -33,6 +49,7 @@ class CONTENT_EXPORT VideoCaptureDeviceClient
~VideoCaptureDeviceClient() override;
// VideoCaptureDevice::Client implementation.
+ bool InitializeJpegDecoder() override;
void OnIncomingCapturedData(
const uint8* data,
int length,
@@ -48,15 +65,32 @@ class CONTENT_EXPORT VideoCaptureDeviceClient
void OnError(const std::string& reason) override;
void OnLog(const std::string& message) override;
+ // JpegDecodeAccelerator::Client implementation.
+ virtual void VideoFrameReady(int32_t buffer_id) override;
+ virtual void NotifyError(int32_t buffer_id,
+ media::JpegDecodeAccelerator::Error error) override;
+
private:
+ // TODO(kcwu): better name
+ void OnIncomingCapturedData2(const CapturedData& captured_data);
+ void DecodeJpegOnIOThread(media::BitstreamBuffer in_buffer,
+ scoped_refptr<media::VideoFrame> out_frame);
+
// The controller to which we post events.
const base::WeakPtr<VideoCaptureController> controller_;
+ scoped_ptr<media::JpegDecodeAccelerator> jpeg_decoder_;
+ // TODO(kcwu): in IOThread
+ std::map<int32_t, CapturedData> jpeg_decode_task_map_;
+ base::WaitableEvent* jpeg_decode_event_;
+
// The pool of shared-memory buffers used for capturing.
const scoped_refptr<VideoCaptureBufferPool> buffer_pool_;
media::VideoPixelFormat last_captured_pixel_format_;
+ int32 next_bitstream_buffer_id_;
+
DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceClient);
};

Powered by Google App Engine
This is Rietveld 408576698