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

Side by Side Diff: media/gpu/vt_video_encode_accelerator_mac.h

Issue 1818903004: Bitrate controller for VideoToolbox Video Encode Accelerator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « media/gpu/ipc/service/BUILD.gn ('k') | media/gpu/vt_video_encode_accelerator_mac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 MEDIA_GPU_VT_VIDEO_ENCODE_ACCELERATOR_MAC_H_ 5 #ifndef MEDIA_GPU_VT_VIDEO_ENCODE_ACCELERATOR_MAC_H_
6 #define MEDIA_GPU_VT_VIDEO_ENCODE_ACCELERATOR_MAC_H_ 6 #define MEDIA_GPU_VT_VIDEO_ENCODE_ACCELERATOR_MAC_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/mac/scoped_cftyperef.h" 10 #include "base/mac/scoped_cftyperef.h"
11 #include "media/base/mac/videotoolbox_glue.h" 11 #include "media/base/mac/videotoolbox_glue.h"
12 #include "media/base/mac/videotoolbox_helpers.h" 12 #include "media/base/mac/videotoolbox_helpers.h"
13 #include "media/gpu/media_gpu_export.h" 13 #include "media/gpu/media_gpu_export.h"
14 #include "media/video/video_encode_accelerator.h" 14 #include "media/video/video_encode_accelerator.h"
15 #include "third_party/webrtc/common_video/include/bitrate_adjuster.h"
15 16
16 namespace media { 17 namespace media {
17 18
18 // VideoToolbox.framework implementation of the VideoEncodeAccelerator 19 // VideoToolbox.framework implementation of the VideoEncodeAccelerator
19 // interface for MacOSX. VideoToolbox makes no guarantees that it is thread 20 // interface for MacOSX. VideoToolbox makes no guarantees that it is thread
20 // safe, so this object is pinned to the thread on which it is constructed. 21 // safe, so this object is pinned to the thread on which it is constructed.
21 class MEDIA_GPU_EXPORT VTVideoEncodeAccelerator 22 class MEDIA_GPU_EXPORT VTVideoEncodeAccelerator
22 : public media::VideoEncodeAccelerator { 23 : public media::VideoEncodeAccelerator {
23 public: 24 public:
24 VTVideoEncodeAccelerator(); 25 VTVideoEncodeAccelerator();
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 void DestroyCompressionSession(); 101 void DestroyCompressionSession();
101 102
102 // VideoToolboxGlue provides access to VideoToolbox at runtime. 103 // VideoToolboxGlue provides access to VideoToolbox at runtime.
103 const VideoToolboxGlue* videotoolbox_glue_; 104 const VideoToolboxGlue* videotoolbox_glue_;
104 base::ScopedCFTypeRef<VTCompressionSessionRef> compression_session_; 105 base::ScopedCFTypeRef<VTCompressionSessionRef> compression_session_;
105 106
106 gfx::Size input_visible_size_; 107 gfx::Size input_visible_size_;
107 size_t bitstream_buffer_size_; 108 size_t bitstream_buffer_size_;
108 int32_t frame_rate_; 109 int32_t frame_rate_;
109 int32_t target_bitrate_; 110 int32_t target_bitrate_;
111 int32_t adjusted_bitrate_;
112
113 // Bitrate adjuster used to fix VideoToolbox's inconsistent bitrate issues.
114 webrtc::BitrateAdjuster bitrate_adjuster_;
110 115
111 // Bitstream buffers ready to be used to return encoded output as a FIFO. 116 // Bitstream buffers ready to be used to return encoded output as a FIFO.
112 std::deque<std::unique_ptr<BitstreamBufferRef>> bitstream_buffer_queue_; 117 std::deque<std::unique_ptr<BitstreamBufferRef>> bitstream_buffer_queue_;
113 118
114 // EncodeOutput needs to be copied into a BitstreamBufferRef as a FIFO. 119 // EncodeOutput needs to be copied into a BitstreamBufferRef as a FIFO.
115 std::deque<std::unique_ptr<EncodeOutput>> encoder_output_queue_; 120 std::deque<std::unique_ptr<EncodeOutput>> encoder_output_queue_;
116 121
117 // Our original calling task runner for the child thread. 122 // Our original calling task runner for the child thread.
118 const scoped_refptr<base::SingleThreadTaskRunner> client_task_runner_; 123 const scoped_refptr<base::SingleThreadTaskRunner> client_task_runner_;
119 124
(...skipping 16 matching lines...) Expand all
136 // other destructors run. 141 // other destructors run.
137 base::WeakPtr<VTVideoEncodeAccelerator> encoder_weak_ptr_; 142 base::WeakPtr<VTVideoEncodeAccelerator> encoder_weak_ptr_;
138 base::WeakPtrFactory<VTVideoEncodeAccelerator> encoder_task_weak_factory_; 143 base::WeakPtrFactory<VTVideoEncodeAccelerator> encoder_task_weak_factory_;
139 144
140 DISALLOW_COPY_AND_ASSIGN(VTVideoEncodeAccelerator); 145 DISALLOW_COPY_AND_ASSIGN(VTVideoEncodeAccelerator);
141 }; 146 };
142 147
143 } // namespace media 148 } // namespace media
144 149
145 #endif // MEDIA_GPU_VT_VIDEO_ENCODE_ACCELERATOR_MAC_H_ 150 #endif // MEDIA_GPU_VT_VIDEO_ENCODE_ACCELERATOR_MAC_H_
OLDNEW
« no previous file with comments | « media/gpu/ipc/service/BUILD.gn ('k') | media/gpu/vt_video_encode_accelerator_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698