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

Unified Diff: content/common/gpu/client/gpu_jpeg_decode_accelerator_host.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/common/gpu/client/gpu_jpeg_decode_accelerator_host.h
diff --git a/content/common/gpu/client/gpu_jpeg_decode_accelerator_host.h b/content/common/gpu/client/gpu_jpeg_decode_accelerator_host.h
new file mode 100644
index 0000000000000000000000000000000000000000..5fe0ff1cee4307db11c6e22a664d95d01a9545a5
--- /dev/null
+++ b/content/common/gpu/client/gpu_jpeg_decode_accelerator_host.h
@@ -0,0 +1,72 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_COMMON_GPU_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_
+#define CONTENT_COMMON_GPU_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_
+
+#include <map>
+#include <vector>
+
+#include "base/memory/weak_ptr.h"
+#include "base/threading/non_thread_safe.h"
+#include "ipc/ipc_listener.h"
+#include "media/video/jpeg_decode_accelerator.h"
+#include "ui/gfx/geometry/size.h"
+
+namespace content {
+class GpuChannelHost;
+
+// This class is used to talk to JpegDecodeAccelerator in the GPU process
+// through IPC messages.
+class GpuJpegDecodeAcceleratorHost
+ : public IPC::Listener,
+ public media::JpegDecodeAccelerator,
+ public base::NonThreadSafe,
+ public base::SupportsWeakPtr<GpuJpegDecodeAcceleratorHost> {
+ public:
+ // |this| is guaranteed not to outlive |channel|. (See comments for
+ // |channel_|.)
+ GpuJpegDecodeAcceleratorHost(GpuChannelHost* channel);
+
+ // IPC::Listener implementation.
+ void OnChannelError() override;
+ bool OnMessageReceived(const IPC::Message& message) override;
+
+ // media::JpegDecodeAccelerator implementation.
+ bool Initialize(
+ media::JpegDecodeAccelerator::Client* client) override;
+ void Decode(const media::BitstreamBuffer& bitstream_buffer,
+ const scoped_refptr<media::VideoFrame>& video_frame) override;
+ void Destroy() override;
+
+ private:
+ // Only Destroy() should be deleting |this|.
+ ~GpuJpegDecodeAcceleratorHost() override;
+
+ // Notify |client_| of an error. Posts a task to avoid re-entrancy.
+ void PostNotifyError(int32_t bitstream_buffer_id, Error error);
+
+ void Send(IPC::Message* message);
+
+ void OnVideoFrameReady(int32_t bitstream_buffer_id);
+ void OnNotifyError(int32_t bitstream_buffer_id, Error error);
+
+ // Unowned reference to the GpuChannelHost to send IPC messages to the GPU
+ // process. |channel_| is always valid as long as it is not NULL.
+ GpuChannelHost* channel_;
+
+ media::JpegDecodeAccelerator::Client* client_;
+
+ // Route ID for the associated decoder in the GPU process.
+ int32 decoder_route_id_;
+
+ // WeakPtr factory for posting tasks back to itself.
+ base::WeakPtrFactory<GpuJpegDecodeAcceleratorHost> weak_this_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(GpuJpegDecodeAcceleratorHost);
+};
+
+} // namespace content
+
+#endif // CONTENT_COMMON_GPU_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_

Powered by Google App Engine
This is Rietveld 408576698