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

Side by Side Diff: content/common/gpu/media/gpu_video_encode_accelerator.h

Issue 826663002: Support multiple video decoders and encoders (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nits Created 5 years, 12 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_ 5 #ifndef CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_
6 #define CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_ 6 #define CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/scoped_vector.h"
11 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
12 #include "content/common/gpu/gpu_command_buffer_stub.h" 13 #include "content/common/gpu/gpu_command_buffer_stub.h"
13 #include "gpu/config/gpu_info.h" 14 #include "gpu/config/gpu_info.h"
14 #include "ipc/ipc_listener.h" 15 #include "ipc/ipc_listener.h"
15 #include "media/video/video_encode_accelerator.h" 16 #include "media/video/video_encode_accelerator.h"
16 #include "ui/gfx/size.h" 17 #include "ui/gfx/size.h"
17 18
18 namespace base { 19 namespace base {
19 20
20 class SharedMemory; 21 class SharedMemory;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 size_t payload_size, 54 size_t payload_size,
54 bool key_frame) override; 55 bool key_frame) override;
55 void NotifyError(media::VideoEncodeAccelerator::Error error) override; 56 void NotifyError(media::VideoEncodeAccelerator::Error error) override;
56 57
57 // GpuCommandBufferStub::DestructionObserver implementation. 58 // GpuCommandBufferStub::DestructionObserver implementation.
58 void OnWillDestroyStub() override; 59 void OnWillDestroyStub() override;
59 60
60 // Static query for supported profiles. This query calls the appropriate 61 // Static query for supported profiles. This query calls the appropriate
61 // platform-specific version. 62 // platform-specific version.
62 static std::vector<gpu::VideoEncodeAcceleratorSupportedProfile> 63 static std::vector<gpu::VideoEncodeAcceleratorSupportedProfile>
63 GetSupportedProfiles(); 64 GetSupportedProfiles();
64 static std::vector<gpu::VideoEncodeAcceleratorSupportedProfile> 65 static std::vector<gpu::VideoEncodeAcceleratorSupportedProfile>
65 ConvertMediaToGpuProfiles(const std::vector< 66 ConvertMediaToGpuProfiles(const std::vector<
66 media::VideoEncodeAccelerator::SupportedProfile>& media_profiles); 67 media::VideoEncodeAccelerator::SupportedProfile>& media_profiles);
67 68
68 private: 69 private:
69 // Create the appropriate platform-specific VEA. 70 // Create the appropriate platform-specific VEA.
Pawel Osciak 2014/12/26 01:11:36 Please update comments.
henryhsu 2014/12/26 08:40:40 Done.
70 static scoped_ptr<media::VideoEncodeAccelerator> CreateEncoder(); 71 static ScopedVector<media::VideoEncodeAccelerator> CreateEncoder();
Pawel Osciak 2014/12/26 01:11:36 CreateEncoders
henryhsu 2014/12/26 08:40:40 Done.
71 72
72 // IPC handlers, proxying media::VideoEncodeAccelerator for the renderer 73 // IPC handlers, proxying media::VideoEncodeAccelerator for the renderer
73 // process. 74 // process.
74 void OnEncode(int32 frame_id, 75 void OnEncode(int32 frame_id,
75 base::SharedMemoryHandle buffer_handle, 76 base::SharedMemoryHandle buffer_handle,
76 uint32 buffer_size, 77 uint32 buffer_size,
77 bool force_keyframe); 78 bool force_keyframe);
78 void OnUseOutputBitstreamBuffer(int32 buffer_id, 79 void OnUseOutputBitstreamBuffer(int32 buffer_id,
79 base::SharedMemoryHandle buffer_handle, 80 base::SharedMemoryHandle buffer_handle,
80 uint32 buffer_size); 81 uint32 buffer_size);
81 void OnRequestEncodingParametersChange(uint32 bitrate, uint32 framerate); 82 void OnRequestEncodingParametersChange(uint32 bitrate, uint32 framerate);
82 83
83 void OnDestroy(); 84 void OnDestroy();
84 85
85 void EncodeFrameFinished(int32 frame_id, scoped_ptr<base::SharedMemory> shm); 86 void EncodeFrameFinished(int32 frame_id, scoped_ptr<base::SharedMemory> shm);
86 87
87 void Send(IPC::Message* message); 88 void Send(IPC::Message* message);
88 // Helper for replying to the creation request. 89 // Helper for replying to the creation request.
89 void SendCreateEncoderReply(IPC::Message* message, bool succeeded); 90 void SendCreateEncoderReply(IPC::Message* message, bool succeeded);
90 91
91 // Route ID to communicate with the host. 92 // Route ID to communicate with the host.
92 int32 host_route_id_; 93 int32 host_route_id_;
93 94
94 // Unowned pointer to the underlying GpuCommandBufferStub. |this| is 95 // Unowned pointer to the underlying GpuCommandBufferStub. |this| is
95 // registered as a DestuctionObserver of |stub_| and will self-delete when 96 // registered as a DestuctionObserver of |stub_| and will self-delete when
96 // |stub_| is destroyed. 97 // |stub_| is destroyed.
97 GpuCommandBufferStub* stub_; 98 GpuCommandBufferStub* stub_;
98 99
99 // Owned pointer to the underlying VideoEncodeAccelerator. 100 // Owned pointer to all VideoEncodeAccelerator.
Pawel Osciak 2014/12/26 01:11:36 s/pointer/pointers/ s/VideoEncodeAccelerator/Video
henryhsu 2014/12/26 08:40:40 encoder_list is not used.
100 scoped_ptr<media::VideoEncodeAccelerator> encoder_; 101 ScopedVector<media::VideoEncodeAccelerator> encoder_list_;
Pawel Osciak 2014/12/26 01:11:36 s/encoder_list_/encoders_/, since it's not a list.
henryhsu 2014/12/26 08:40:40 Done.
102 // Pointer to valid VideoEncodeAccelerator.
Pawel Osciak 2014/12/26 01:11:36 What does "valid" mean here?
henryhsu 2014/12/26 08:40:40 Done.
103 media::VideoEncodeAccelerator* encoder_;
101 base::Callback<bool(void)> make_context_current_; 104 base::Callback<bool(void)> make_context_current_;
102 105
103 // Video encoding parameters. 106 // Video encoding parameters.
104 media::VideoFrame::Format input_format_; 107 media::VideoFrame::Format input_format_;
105 gfx::Size input_visible_size_; 108 gfx::Size input_visible_size_;
106 gfx::Size input_coded_size_; 109 gfx::Size input_coded_size_;
107 size_t output_buffer_size_; 110 size_t output_buffer_size_;
108 111
109 // Weak pointer for media::VideoFrames that refer back to |this|. 112 // Weak pointer for media::VideoFrames that refer back to |this|.
110 base::WeakPtrFactory<GpuVideoEncodeAccelerator> weak_this_factory_; 113 base::WeakPtrFactory<GpuVideoEncodeAccelerator> weak_this_factory_;
111 114
112 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAccelerator); 115 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAccelerator);
113 }; 116 };
114 117
115 } // namespace content 118 } // namespace content
116 119
117 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_ 120 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698