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

Side by Side Diff: chrome/gpu/gpu_arc_video_encode_accelerator.h

Issue 2892863002: ArcBridge: Add VideoEncodeAccelerator implementation. (Closed)
Patch Set: add missing public_dep to the typemap file. Created 3 years, 5 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
« no previous file with comments | « chrome/gpu/chrome_content_gpu_client.cc ('k') | chrome/gpu/gpu_arc_video_encode_accelerator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_GPU_GPU_ARC_VIDEO_ENCODE_ACCELERATOR_H_
6 #define CHROME_GPU_GPU_ARC_VIDEO_ENCODE_ACCELERATOR_H_
7
8 #include <memory>
9 #include <vector>
10
11 #include "base/files/scoped_file.h"
12 #include "base/macros.h"
13 #include "components/arc/common/video_encode_accelerator.mojom.h"
14 #include "components/arc/video_accelerator/video_accelerator.h"
15 #include "gpu/command_buffer/service/gpu_preferences.h"
16 #include "media/video/video_encode_accelerator.h"
17
18 namespace chromeos {
19 namespace arc {
20
21 // GpuArcVideoEncodeAccelerator manages life-cycle and IPC message translation
22 // for media::VideoEncodeAccelerator.
23 class GpuArcVideoEncodeAccelerator
24 : public ::arc::mojom::VideoEncodeAccelerator,
25 public media::VideoEncodeAccelerator::Client {
26 public:
27 explicit GpuArcVideoEncodeAccelerator(
28 const gpu::GpuPreferences& gpu_preferences);
29 ~GpuArcVideoEncodeAccelerator() override;
30
31 private:
32 using VideoPixelFormat = media::VideoPixelFormat;
33 using VideoCodecProfile = media::VideoCodecProfile;
34 using Error = media::VideoEncodeAccelerator::Error;
35 using VideoEncodeClientPtr = ::arc::mojom::VideoEncodeClientPtr;
36
37 // VideoEncodeAccelerator::Client implementation.
38 void RequireBitstreamBuffers(unsigned int input_count,
39 const gfx::Size& input_coded_size,
40 size_t output_buffer_size) override;
41 void BitstreamBufferReady(int32_t bitstream_buffer_id,
42 size_t payload_size,
43 bool key_frame,
44 base::TimeDelta timestamp) override;
45 void NotifyError(Error error) override;
46
47 // ::arc::mojom::VideoEncodeAccelerator implementation.
48 void GetSupportedProfiles(
49 const GetSupportedProfilesCallback& callback) override;
50 void Initialize(VideoPixelFormat input_format,
51 const gfx::Size& visible_size,
52 VideoEncodeAccelerator::StorageType input_storage,
53 VideoCodecProfile output_profile,
54 uint32_t initial_bitrate,
55 VideoEncodeClientPtr client,
56 const InitializeCallback& callback) override;
57 void Encode(mojo::ScopedHandle fd,
58 std::vector<::arc::VideoFramePlane> planes,
59 int64_t timestamp,
60 bool force_keyframe) override;
61 void UseOutputBitstreamBuffer(int32_t bitstream_buffer_id,
62 mojo::ScopedHandle shmem_fd,
63 uint32_t offset,
64 uint32_t size) override;
65 void RequestEncodingParametersChange(uint32_t bitrate,
66 uint32_t framerate) override;
67
68 // Unwraps a file descriptor from the given mojo::ScopedHandle.
69 // If an error is encountered, it returns an invalid base::ScopedFD and
70 // notifies client about the error via VideoEncodeClient::NotifyError.
71 base::ScopedFD UnwrapFdFromMojoHandle(mojo::ScopedHandle handle);
72
73 gpu::GpuPreferences gpu_preferences_;
74 std::unique_ptr<media::VideoEncodeAccelerator> accelerator_;
75 ::arc::mojom::VideoEncodeClientPtr client_;
76 gfx::Size coded_size_;
77 gfx::Size visible_size_;
78 VideoPixelFormat input_pixel_format_;
79
80 DISALLOW_COPY_AND_ASSIGN(GpuArcVideoEncodeAccelerator);
81 };
82
83 } // namespace arc
84 } // namespace chromeos
85
86 #endif // CHROME_GPU_GPU_ARC_VIDEO_ENCODE_ACCELERATOR_H_
OLDNEW
« no previous file with comments | « chrome/gpu/chrome_content_gpu_client.cc ('k') | chrome/gpu/gpu_arc_video_encode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698