OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 if (encoder_->InitEncode(settings, numberOfCores, maxPayloadSize) != 0) { | 132 if (encoder_->InitEncode(settings, numberOfCores, maxPayloadSize) != 0) { |
133 LOG(LS_ERROR) << "Failed to initialize the encoder associated with " | 133 LOG(LS_ERROR) << "Failed to initialize the encoder associated with " |
134 "payload name: " << settings->plName; | 134 "payload name: " << settings->plName; |
135 return -1; | 135 return -1; |
136 } | 136 } |
137 return 0; | 137 return 0; |
138 } | 138 } |
139 | 139 |
140 int32_t VCMGenericEncoder::Encode(const VideoFrame& inputFrame, | 140 int32_t VCMGenericEncoder::Encode(const VideoFrame& inputFrame, |
141 const CodecSpecificInfo* codecSpecificInfo, | 141 const CodecSpecificInfo* codecSpecificInfo, |
142 const std::vector<FrameType>& frameTypes) { | 142 const std::vector<FrameType>& frameTypes) { |
stefan-webrtc
2015/10/01 09:21:20
DCHECK on frame types being valid video types?
pbos-webrtc
2015/10/06 15:42:45
Done.
| |
143 std::vector<VideoFrameType> video_frame_types(frameTypes.size(), | |
144 kDeltaFrame); | |
145 VCMEncodedFrame::ConvertFrameTypes(frameTypes, &video_frame_types); | |
146 | |
147 rotation_ = inputFrame.rotation(); | 143 rotation_ = inputFrame.rotation(); |
148 | 144 |
149 if (vcm_encoded_frame_callback_) { | 145 if (vcm_encoded_frame_callback_) { |
150 // Keep track of the current frame rotation and apply to the output of the | 146 // Keep track of the current frame rotation and apply to the output of the |
151 // encoder. There might not be exact as the encoder could have one frame | 147 // encoder. There might not be exact as the encoder could have one frame |
152 // delay but it should be close enough. | 148 // delay but it should be close enough. |
153 vcm_encoded_frame_callback_->SetRotation(rotation_); | 149 vcm_encoded_frame_callback_->SetRotation(rotation_); |
154 } | 150 } |
155 | 151 |
156 int32_t result = | 152 int32_t result = encoder_->Encode(inputFrame, codecSpecificInfo, &frameTypes); |
157 encoder_->Encode(inputFrame, codecSpecificInfo, &video_frame_types); | |
158 if (is_screenshare_ && | 153 if (is_screenshare_ && |
159 result == WEBRTC_VIDEO_CODEC_TARGET_BITRATE_OVERSHOOT) { | 154 result == WEBRTC_VIDEO_CODEC_TARGET_BITRATE_OVERSHOOT) { |
160 // Target bitrate exceeded, encoder state has been reset - try again. | 155 // Target bitrate exceeded, encoder state has been reset - try again. |
161 return encoder_->Encode(inputFrame, codecSpecificInfo, &video_frame_types); | 156 return encoder_->Encode(inputFrame, codecSpecificInfo, &frameTypes); |
162 } | 157 } |
163 | 158 |
164 return result; | 159 return result; |
165 } | 160 } |
166 | 161 |
167 int32_t | 162 int32_t |
168 VCMGenericEncoder::SetChannelParameters(int32_t packetLoss, int64_t rtt) | 163 VCMGenericEncoder::SetChannelParameters(int32_t packetLoss, int64_t rtt) |
169 { | 164 { |
170 return encoder_->SetChannelParameters(packetLoss, rtt); | 165 return encoder_->SetChannelParameters(packetLoss, rtt); |
171 } | 166 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
216 | 211 |
217 int32_t | 212 int32_t |
218 VCMGenericEncoder::SetPeriodicKeyFrames(bool enable) | 213 VCMGenericEncoder::SetPeriodicKeyFrames(bool enable) |
219 { | 214 { |
220 return encoder_->SetPeriodicKeyFrames(enable); | 215 return encoder_->SetPeriodicKeyFrames(enable); |
221 } | 216 } |
222 | 217 |
223 int32_t VCMGenericEncoder::RequestFrame( | 218 int32_t VCMGenericEncoder::RequestFrame( |
224 const std::vector<FrameType>& frame_types) { | 219 const std::vector<FrameType>& frame_types) { |
225 VideoFrame image; | 220 VideoFrame image; |
226 std::vector<VideoFrameType> video_frame_types(frame_types.size(), | 221 return encoder_->Encode(image, NULL, &frame_types); |
227 kDeltaFrame); | |
228 VCMEncodedFrame::ConvertFrameTypes(frame_types, &video_frame_types); | |
229 return encoder_->Encode(image, NULL, &video_frame_types); | |
230 } | 222 } |
231 | 223 |
232 int32_t | 224 int32_t |
233 VCMGenericEncoder::RegisterEncodeCallback(VCMEncodedFrameCallback* VCMencodedFra meCallback) | 225 VCMGenericEncoder::RegisterEncodeCallback(VCMEncodedFrameCallback* VCMencodedFra meCallback) |
234 { | 226 { |
235 VCMencodedFrameCallback->SetInternalSource(internal_source_); | 227 VCMencodedFrameCallback->SetInternalSource(internal_source_); |
236 vcm_encoded_frame_callback_ = VCMencodedFrameCallback; | 228 vcm_encoded_frame_callback_ = VCMencodedFrameCallback; |
237 return encoder_->RegisterEncodeCompleteCallback(VCMencodedFrameCallback); | 229 return encoder_->RegisterEncodeCompleteCallback(VCMencodedFrameCallback); |
238 } | 230 } |
239 | 231 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
330 } | 322 } |
331 | 323 |
332 void | 324 void |
333 VCMEncodedFrameCallback::SetMediaOpt( | 325 VCMEncodedFrameCallback::SetMediaOpt( |
334 media_optimization::MediaOptimization *mediaOpt) | 326 media_optimization::MediaOptimization *mediaOpt) |
335 { | 327 { |
336 _mediaOpt = mediaOpt; | 328 _mediaOpt = mediaOpt; |
337 } | 329 } |
338 | 330 |
339 } // namespace webrtc | 331 } // namespace webrtc |
OLD | NEW |