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

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

Issue 2061823003: media: Drop "media::" in media/gpu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: work around clang format by adding an empty line Created 4 years, 6 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 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 #include "third_party/webrtc/common_video/include/bitrate_adjuster.h"
16 16
17 namespace media { 17 namespace media {
18 18
19 // VideoToolbox.framework implementation of the VideoEncodeAccelerator 19 // VideoToolbox.framework implementation of the VideoEncodeAccelerator
20 // interface for MacOSX. VideoToolbox makes no guarantees that it is thread 20 // interface for MacOSX. VideoToolbox makes no guarantees that it is thread
21 // 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.
22 class MEDIA_GPU_EXPORT VTVideoEncodeAccelerator 22 class MEDIA_GPU_EXPORT VTVideoEncodeAccelerator
23 : public media::VideoEncodeAccelerator { 23 : public VideoEncodeAccelerator {
24 public: 24 public:
25 VTVideoEncodeAccelerator(); 25 VTVideoEncodeAccelerator();
26 ~VTVideoEncodeAccelerator() override; 26 ~VTVideoEncodeAccelerator() override;
27 27
28 // media::VideoEncodeAccelerator implementation. 28 // VideoEncodeAccelerator implementation.
29 media::VideoEncodeAccelerator::SupportedProfiles GetSupportedProfiles() 29 VideoEncodeAccelerator::SupportedProfiles GetSupportedProfiles() override;
30 override; 30 bool Initialize(VideoPixelFormat format,
31 bool Initialize(media::VideoPixelFormat format,
32 const gfx::Size& input_visible_size, 31 const gfx::Size& input_visible_size,
33 media::VideoCodecProfile output_profile, 32 VideoCodecProfile output_profile,
34 uint32_t initial_bitrate, 33 uint32_t initial_bitrate,
35 Client* client) override; 34 Client* client) override;
36 void Encode(const scoped_refptr<media::VideoFrame>& frame, 35 void Encode(const scoped_refptr<VideoFrame>& frame,
37 bool force_keyframe) override; 36 bool force_keyframe) override;
38 void UseOutputBitstreamBuffer(const media::BitstreamBuffer& buffer) override; 37 void UseOutputBitstreamBuffer(const BitstreamBuffer& buffer) override;
39 void RequestEncodingParametersChange(uint32_t bitrate, 38 void RequestEncodingParametersChange(uint32_t bitrate,
40 uint32_t framerate) override; 39 uint32_t framerate) override;
41 void Destroy() override; 40 void Destroy() override;
42 41
43 private: 42 private:
44 using CMSampleBufferRef = CoreMediaGlue::CMSampleBufferRef; 43 using CMSampleBufferRef = CoreMediaGlue::CMSampleBufferRef;
45 using VTCompressionSessionRef = VideoToolboxGlue::VTCompressionSessionRef; 44 using VTCompressionSessionRef = VideoToolboxGlue::VTCompressionSessionRef;
46 using VTEncodeInfoFlags = VideoToolboxGlue::VTEncodeInfoFlags; 45 using VTEncodeInfoFlags = VideoToolboxGlue::VTEncodeInfoFlags;
47 46
48 // Holds the associated data of a video frame being processed. 47 // Holds the associated data of a video frame being processed.
49 struct InProgressFrameEncode; 48 struct InProgressFrameEncode;
50 49
51 // Holds output buffers coming from the encoder. 50 // Holds output buffers coming from the encoder.
52 struct EncodeOutput; 51 struct EncodeOutput;
53 52
54 // Holds output buffers coming from the client ready to be filled. 53 // Holds output buffers coming from the client ready to be filled.
55 struct BitstreamBufferRef; 54 struct BitstreamBufferRef;
56 55
57 // Encoding tasks to be run on |encoder_thread_|. 56 // Encoding tasks to be run on |encoder_thread_|.
58 void EncodeTask(const scoped_refptr<media::VideoFrame>& frame, 57 void EncodeTask(const scoped_refptr<VideoFrame>& frame, bool force_keyframe);
59 bool force_keyframe);
60 void UseOutputBitstreamBufferTask( 58 void UseOutputBitstreamBufferTask(
61 std::unique_ptr<BitstreamBufferRef> buffer_ref); 59 std::unique_ptr<BitstreamBufferRef> buffer_ref);
62 void RequestEncodingParametersChangeTask(uint32_t bitrate, 60 void RequestEncodingParametersChangeTask(uint32_t bitrate,
63 uint32_t framerate); 61 uint32_t framerate);
64 void DestroyTask(); 62 void DestroyTask();
65 63
66 // Helper function to set bitrate. 64 // Helper function to set bitrate.
67 void SetAdjustedBitrate(int32_t bitrate); 65 void SetAdjustedBitrate(int32_t bitrate);
68 66
69 // Helper function to notify the client of an error on |client_task_runner_|. 67 // Helper function to notify the client of an error on |client_task_runner_|.
70 void NotifyError(media::VideoEncodeAccelerator::Error error); 68 void NotifyError(VideoEncodeAccelerator::Error error);
71 69
72 // Compression session callback function to handle compressed frames. 70 // Compression session callback function to handle compressed frames.
73 static void CompressionCallback(void* encoder_opaque, 71 static void CompressionCallback(void* encoder_opaque,
74 void* request_opaque, 72 void* request_opaque,
75 OSStatus status, 73 OSStatus status,
76 VTEncodeInfoFlags info, 74 VTEncodeInfoFlags info,
77 CMSampleBufferRef sbuf); 75 CMSampleBufferRef sbuf);
78 void CompressionCallbackTask(OSStatus status, 76 void CompressionCallbackTask(OSStatus status,
79 std::unique_ptr<EncodeOutput> encode_output); 77 std::unique_ptr<EncodeOutput> encode_output);
80 78
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // other destructors run. 143 // other destructors run.
146 base::WeakPtr<VTVideoEncodeAccelerator> encoder_weak_ptr_; 144 base::WeakPtr<VTVideoEncodeAccelerator> encoder_weak_ptr_;
147 base::WeakPtrFactory<VTVideoEncodeAccelerator> encoder_task_weak_factory_; 145 base::WeakPtrFactory<VTVideoEncodeAccelerator> encoder_task_weak_factory_;
148 146
149 DISALLOW_COPY_AND_ASSIGN(VTVideoEncodeAccelerator); 147 DISALLOW_COPY_AND_ASSIGN(VTVideoEncodeAccelerator);
150 }; 148 };
151 149
152 } // namespace media 150 } // namespace media
153 151
154 #endif // MEDIA_GPU_VT_VIDEO_ENCODE_ACCELERATOR_MAC_H_ 152 #endif // MEDIA_GPU_VT_VIDEO_ENCODE_ACCELERATOR_MAC_H_
OLDNEW
« no previous file with comments | « media/gpu/vt_video_decode_accelerator_mac.cc ('k') | media/gpu/vt_video_encode_accelerator_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698