OLD | NEW |
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_RENDERER_MEDIA_RTC_VIDEO_ENCODER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_RTC_VIDEO_ENCODER_H_ |
6 #define CONTENT_RENDERER_MEDIA_RTC_VIDEO_ENCODER_H_ | 6 #define CONTENT_RENDERER_MEDIA_RTC_VIDEO_ENCODER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 int32_t RegisterEncodeCompleteCallback( | 57 int32_t RegisterEncodeCompleteCallback( |
58 webrtc::EncodedImageCallback* callback) override; | 58 webrtc::EncodedImageCallback* callback) override; |
59 int32_t Release() override; | 59 int32_t Release() override; |
60 int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override; | 60 int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override; |
61 int32_t SetRates(uint32_t new_bit_rate, uint32_t frame_rate) override; | 61 int32_t SetRates(uint32_t new_bit_rate, uint32_t frame_rate) override; |
62 | 62 |
63 private: | 63 private: |
64 class Impl; | 64 class Impl; |
65 friend class RTCVideoEncoder::Impl; | 65 friend class RTCVideoEncoder::Impl; |
66 | 66 |
67 // Return an encoded output buffer to WebRTC. | |
68 void ReturnEncodedImage(scoped_ptr<webrtc::EncodedImage> image, | |
69 int32_t bitstream_buffer_id, | |
70 uint16_t picture_id); | |
71 | |
72 void NotifyError(int32_t error); | |
73 | |
74 void RecordInitEncodeUMA(int32_t init_retval, | 67 void RecordInitEncodeUMA(int32_t init_retval, |
75 media::VideoCodecProfile profile); | 68 media::VideoCodecProfile profile); |
76 | 69 |
77 base::ThreadChecker thread_checker_; | |
78 | |
79 // The video codec type, as reported to WebRTC. | 70 // The video codec type, as reported to WebRTC. |
80 const webrtc::VideoCodecType video_codec_type_; | 71 const webrtc::VideoCodecType video_codec_type_; |
81 | 72 |
82 // Factory for creating VEAs, shared memory buffers, etc. | 73 // Factory for creating VEAs, shared memory buffers, etc. |
83 media::GpuVideoAcceleratorFactories* gpu_factories_; | 74 media::GpuVideoAcceleratorFactories* gpu_factories_; |
84 | 75 |
85 // Task runner that the video accelerator runs on. | 76 // Task runner that the video accelerator runs on. |
86 const scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner_; | 77 const scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner_; |
87 | 78 |
88 // webrtc::VideoEncoder encode complete callback. | |
89 webrtc::EncodedImageCallback* encoded_image_callback_; | |
90 | |
91 // The RTCVideoEncoder::Impl that does all the work. | 79 // The RTCVideoEncoder::Impl that does all the work. |
92 scoped_refptr<Impl> impl_; | 80 scoped_refptr<Impl> impl_; |
93 | 81 |
94 // We cannot immediately return error conditions to the WebRTC user of this | |
95 // class, as there is no error callback in the webrtc::VideoEncoder interface. | |
96 // Instead, we cache an error status here and return it the next time an | |
97 // interface entry point is called. | |
98 int32_t impl_status_; | |
99 | |
100 // Weak pointer factory for posting back VEA::Client notifications to | |
101 // RTCVideoEncoder. | |
102 // NOTE: Weak pointers must be invalidated before all other member variables. | |
103 base::WeakPtrFactory<RTCVideoEncoder> weak_factory_; | |
104 | |
105 DISALLOW_COPY_AND_ASSIGN(RTCVideoEncoder); | 82 DISALLOW_COPY_AND_ASSIGN(RTCVideoEncoder); |
106 }; | 83 }; |
107 | 84 |
108 } // namespace content | 85 } // namespace content |
109 | 86 |
110 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_ENCODER_H_ | 87 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_ENCODER_H_ |
OLD | NEW |