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