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

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

Issue 2308533003: Break tight coupling of VideoCaptureDeviceClient to renderer_host (Closed)
Patch Set: miu's comments Created 4 years, 3 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_gpu_jpeg_decoder.h
diff --git a/content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.h b/content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.h
index c1541ec7d2b6cc8db91dff3b264962c710bf3e7f..9367df232b6a9a3c52db25a354eec9029f4bce71 100644
--- a/content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.h
+++ b/content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.h
@@ -31,17 +31,7 @@ class VideoFrame;
namespace content {
-// Adapter to GpuJpegDecodeAccelerator for VideoCaptureDevice::Client. It takes
-// care of GpuJpegDecodeAccelerator creation, shared memory, and threading
-// issues.
-//
-// All public methods except JpegDecodeAccelerator::Client ones should be called
-// on the same thread. JpegDecodeAccelerator::Client methods should be called on
-// the IO thread.
-class CONTENT_EXPORT VideoCaptureGpuJpegDecoder
- : public media::JpegDecodeAccelerator::Client,
- public base::NonThreadSafe,
- public base::SupportsWeakPtr<VideoCaptureGpuJpegDecoder> {
+class CONTENT_EXPORT VideoCaptureJpegDecoder {
public:
// Enumeration of decoder status. The enumeration is published for clients to
// decide the behavior according to STATUS.
@@ -52,31 +42,59 @@ class CONTENT_EXPORT VideoCaptureGpuJpegDecoder
// decode error.
};
- typedef base::Callback<void(
+ using DecodeDoneCB = base::Callback<void(
std::unique_ptr<media::VideoCaptureDevice::Client::Buffer>,
- const scoped_refptr<media::VideoFrame>&)>
- DecodeDoneCB;
+ const scoped_refptr<media::VideoFrame>&)>;
- // |decode_done_cb| is called on the IO thread when decode succeed. This can
- // be on any thread. |decode_done_cb| is never called after
- // VideoCaptureGpuJpegDecoder is destroyed.
- explicit VideoCaptureGpuJpegDecoder(const DecodeDoneCB& decode_done_cb);
- ~VideoCaptureGpuJpegDecoder() override;
+ virtual ~VideoCaptureJpegDecoder() {}
// Creates and intializes decoder asynchronously.
- void Initialize();
+ virtual void Initialize() = 0;
// Returns initialization status.
- STATUS GetStatus() const;
+ virtual STATUS GetStatus() const = 0;
// Decodes a JPEG picture.
+ virtual void DecodeCapturedData(
+ const uint8_t* data,
+ size_t in_buffer_size,
+ const media::VideoCaptureFormat& frame_format,
+ base::TimeTicks reference_time,
+ base::TimeDelta timestamp,
+ std::unique_ptr<media::VideoCaptureDevice::Client::Buffer>
+ out_buffer) = 0;
+};
+
+// Adapter to GpuJpegDecodeAccelerator for VideoCaptureDevice::Client. It takes
+// care of GpuJpegDecodeAccelerator creation, shared memory, and threading
+// issues.
+//
+// All public methods except JpegDecodeAccelerator::Client ones should be called
+// on the same thread. JpegDecodeAccelerator::Client methods should be called on
+// the IO thread.
+class CONTENT_EXPORT VideoCaptureGpuJpegDecoder
+ : public VideoCaptureJpegDecoder,
+ public media::JpegDecodeAccelerator::Client,
+ public base::NonThreadSafe,
+ public base::SupportsWeakPtr<VideoCaptureGpuJpegDecoder> {
+ public:
+ // |decode_done_cb| is called on the IO thread when decode succeed. This can
+ // be on any thread. |decode_done_cb| is never called after
+ // VideoCaptureGpuJpegDecoder is destroyed.
+ explicit VideoCaptureGpuJpegDecoder(const DecodeDoneCB& decode_done_cb);
+ ~VideoCaptureGpuJpegDecoder() override;
+
+ // Implementation of VideoCaptureJpegDecoder:
+ void Initialize() override;
+ STATUS GetStatus() const override;
void DecodeCapturedData(
const uint8_t* data,
size_t in_buffer_size,
const media::VideoCaptureFormat& frame_format,
base::TimeTicks reference_time,
base::TimeDelta timestamp,
- std::unique_ptr<media::VideoCaptureDevice::Client::Buffer> out_buffer);
+ std::unique_ptr<media::VideoCaptureDevice::Client::Buffer> out_buffer)
+ override;
// JpegDecodeAccelerator::Client implementation.
// These will be called on IO thread.

Powered by Google App Engine
This is Rietveld 408576698