OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CAST_SENDER_H264_VT_ENCODER_H_ | 5 #ifndef MEDIA_CAST_SENDER_H264_VT_ENCODER_H_ |
6 #define MEDIA_CAST_SENDER_H264_VT_ENCODER_H_ | 6 #define MEDIA_CAST_SENDER_H264_VT_ENCODER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/mac/scoped_cftyperef.h" | 10 #include "base/mac/scoped_cftyperef.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/power_monitor/power_observer.h" | 12 #include "base/power_monitor/power_observer.h" |
13 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
14 #include "media/base/mac/videotoolbox_glue.h" | 14 #include "media/base/mac/videotoolbox_glue.h" |
| 15 #include "media/base/mac/videotoolbox_helpers.h" |
15 #include "media/cast/sender/size_adaptable_video_encoder_base.h" | 16 #include "media/cast/sender/size_adaptable_video_encoder_base.h" |
16 #include "media/cast/sender/video_encoder.h" | 17 #include "media/cast/sender/video_encoder.h" |
17 | 18 |
18 namespace media { | 19 namespace media { |
19 namespace cast { | 20 namespace cast { |
20 | 21 |
21 // VideoToolbox implementation of the media::cast::VideoEncoder interface. | 22 // VideoToolbox implementation of the media::cast::VideoEncoder interface. |
22 // VideoToolbox makes no guarantees that it is thread safe, so this object is | 23 // VideoToolbox makes no guarantees that it is thread safe, so this object is |
23 // pinned to the thread on which it is constructed. Supports changing frame | 24 // pinned to the thread on which it is constructed. Supports changing frame |
24 // sizes directly. Implements the base::PowerObserver interface to reset the | 25 // sizes directly. Implements the base::PowerObserver interface to reset the |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 69 |
69 // Destroy the current compression session if any. Blocks until all pending | 70 // Destroy the current compression session if any. Blocks until all pending |
70 // frames have been flushed out (similar to EmitFrames without doing any | 71 // frames have been flushed out (similar to EmitFrames without doing any |
71 // encoding work). | 72 // encoding work). |
72 void DestroyCompressionSession(); | 73 void DestroyCompressionSession(); |
73 | 74 |
74 // Update the encoder's target frame size by resetting the compression | 75 // Update the encoder's target frame size by resetting the compression |
75 // session. This will also update the video frame factory. | 76 // session. This will also update the video frame factory. |
76 void UpdateFrameSize(const gfx::Size& size_needed); | 77 void UpdateFrameSize(const gfx::Size& size_needed); |
77 | 78 |
78 // Set a compression session property. | |
79 bool SetSessionProperty(CFStringRef key, int32_t value); | |
80 bool SetSessionProperty(CFStringRef key, bool value); | |
81 bool SetSessionProperty(CFStringRef key, CFStringRef value); | |
82 | |
83 // Compression session callback function to handle compressed frames. | 79 // Compression session callback function to handle compressed frames. |
84 static void CompressionCallback(void* encoder_opaque, | 80 static void CompressionCallback(void* encoder_opaque, |
85 void* request_opaque, | 81 void* request_opaque, |
86 OSStatus status, | 82 OSStatus status, |
87 VTEncodeInfoFlags info, | 83 VTEncodeInfoFlags info, |
88 CMSampleBufferRef sbuf); | 84 CMSampleBufferRef sbuf); |
89 | 85 |
90 // The cast environment (contains worker threads & more). | 86 // The cast environment (contains worker threads & more). |
91 const scoped_refptr<CastEnvironment> cast_environment_; | 87 const scoped_refptr<CastEnvironment> cast_environment_; |
92 | 88 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // NOTE: Weak pointers must be invalidated before all other member variables. | 122 // NOTE: Weak pointers must be invalidated before all other member variables. |
127 base::WeakPtrFactory<H264VideoToolboxEncoder> weak_factory_; | 123 base::WeakPtrFactory<H264VideoToolboxEncoder> weak_factory_; |
128 | 124 |
129 DISALLOW_COPY_AND_ASSIGN(H264VideoToolboxEncoder); | 125 DISALLOW_COPY_AND_ASSIGN(H264VideoToolboxEncoder); |
130 }; | 126 }; |
131 | 127 |
132 } // namespace cast | 128 } // namespace cast |
133 } // namespace media | 129 } // namespace media |
134 | 130 |
135 #endif // MEDIA_CAST_SENDER_H264_VT_ENCODER_H_ | 131 #endif // MEDIA_CAST_SENDER_H264_VT_ENCODER_H_ |
OLD | NEW |