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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 void ViEEncoder::Pause() { | 184 void ViEEncoder::Pause() { |
185 CriticalSectionScoped cs(data_cs_.get()); | 185 CriticalSectionScoped cs(data_cs_.get()); |
186 encoder_paused_ = true; | 186 encoder_paused_ = true; |
187 } | 187 } |
188 | 188 |
189 void ViEEncoder::Restart() { | 189 void ViEEncoder::Restart() { |
190 CriticalSectionScoped cs(data_cs_.get()); | 190 CriticalSectionScoped cs(data_cs_.get()); |
191 encoder_paused_ = false; | 191 encoder_paused_ = false; |
192 } | 192 } |
193 | 193 |
194 uint8_t ViEEncoder::NumberOfCodecs() { | |
195 return vcm_->NumberOfCodecs(); | |
196 } | |
197 | |
198 int32_t ViEEncoder::GetCodec(uint8_t list_index, VideoCodec* video_codec) { | |
199 if (vcm_->Codec(list_index, video_codec) != 0) { | |
200 return -1; | |
201 } | |
202 return 0; | |
203 } | |
204 | |
205 int32_t ViEEncoder::RegisterExternalEncoder(webrtc::VideoEncoder* encoder, | 194 int32_t ViEEncoder::RegisterExternalEncoder(webrtc::VideoEncoder* encoder, |
206 uint8_t pl_type, | 195 uint8_t pl_type, |
207 bool internal_source) { | 196 bool internal_source) { |
208 if (encoder == NULL) | |
209 return -1; | |
210 | |
211 if (vcm_->RegisterExternalEncoder(encoder, pl_type, internal_source) != | 197 if (vcm_->RegisterExternalEncoder(encoder, pl_type, internal_source) != |
212 VCM_OK) { | 198 VCM_OK) { |
213 return -1; | 199 return -1; |
214 } | 200 } |
215 return 0; | 201 return 0; |
216 } | 202 } |
217 | 203 |
218 int32_t ViEEncoder::DeRegisterExternalEncoder(uint8_t pl_type) { | 204 int32_t ViEEncoder::DeRegisterExternalEncoder(uint8_t pl_type) { |
219 if (vcm_->RegisterExternalEncoder(NULL, pl_type) != VCM_OK) { | 205 if (vcm_->RegisterExternalEncoder(NULL, pl_type) != VCM_OK) { |
220 return -1; | 206 return -1; |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 decimated_frame = &copied_frame; | 395 decimated_frame = &copied_frame; |
410 } | 396 } |
411 pre_encode_callback_->FrameCallback(decimated_frame); | 397 pre_encode_callback_->FrameCallback(decimated_frame); |
412 } | 398 } |
413 | 399 |
414 // If the frame was not resampled, scaled, or touched by FrameCallback => use | 400 // If the frame was not resampled, scaled, or touched by FrameCallback => use |
415 // original. The frame is const from here. | 401 // original. The frame is const from here. |
416 const VideoFrame* output_frame = | 402 const VideoFrame* output_frame = |
417 (decimated_frame != NULL) ? decimated_frame : &video_frame; | 403 (decimated_frame != NULL) ? decimated_frame : &video_frame; |
418 | 404 |
419 #ifdef VIDEOCODEC_VP8 | |
420 if (codec_type == webrtc::kVideoCodecVP8) { | 405 if (codec_type == webrtc::kVideoCodecVP8) { |
421 webrtc::CodecSpecificInfo codec_specific_info; | 406 webrtc::CodecSpecificInfo codec_specific_info; |
422 codec_specific_info.codecType = webrtc::kVideoCodecVP8; | 407 codec_specific_info.codecType = webrtc::kVideoCodecVP8; |
423 { | 408 { |
424 CriticalSectionScoped cs(data_cs_.get()); | 409 CriticalSectionScoped cs(data_cs_.get()); |
425 codec_specific_info.codecSpecific.VP8.hasReceivedRPSI = | 410 codec_specific_info.codecSpecific.VP8.hasReceivedRPSI = |
426 has_received_rpsi_; | 411 has_received_rpsi_; |
427 codec_specific_info.codecSpecific.VP8.hasReceivedSLI = | 412 codec_specific_info.codecSpecific.VP8.hasReceivedSLI = |
428 has_received_sli_; | 413 has_received_sli_; |
429 codec_specific_info.codecSpecific.VP8.pictureIdRPSI = | 414 codec_specific_info.codecSpecific.VP8.pictureIdRPSI = |
430 picture_id_rpsi_; | 415 picture_id_rpsi_; |
431 codec_specific_info.codecSpecific.VP8.pictureIdSLI = | 416 codec_specific_info.codecSpecific.VP8.pictureIdSLI = |
432 picture_id_sli_; | 417 picture_id_sli_; |
433 has_received_sli_ = false; | 418 has_received_sli_ = false; |
434 has_received_rpsi_ = false; | 419 has_received_rpsi_ = false; |
435 } | 420 } |
436 | 421 |
437 vcm_->AddVideoFrame(*output_frame, vpm_->ContentMetrics(), | 422 vcm_->AddVideoFrame(*output_frame, vpm_->ContentMetrics(), |
438 &codec_specific_info); | 423 &codec_specific_info); |
439 return; | 424 return; |
440 } | 425 } |
441 #endif | |
442 vcm_->AddVideoFrame(*output_frame); | 426 vcm_->AddVideoFrame(*output_frame); |
443 } | 427 } |
444 | 428 |
445 int ViEEncoder::SendKeyFrame() { | 429 int ViEEncoder::SendKeyFrame() { |
446 return vcm_->IntraFrameRequest(0); | 430 return vcm_->IntraFrameRequest(0); |
447 } | 431 } |
448 | 432 |
449 uint32_t ViEEncoder::LastObservedBitrateBps() const { | 433 uint32_t ViEEncoder::LastObservedBitrateBps() const { |
450 CriticalSectionScoped cs(data_cs_.get()); | 434 CriticalSectionScoped cs(data_cs_.get()); |
451 return last_observed_bitrate_bps_; | 435 return last_observed_bitrate_bps_; |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 const uint32_t width, | 644 const uint32_t width, |
661 const uint32_t height) { | 645 const uint32_t height) { |
662 return vpm_->SetTargetResolution(width, height, frame_rate); | 646 return vpm_->SetTargetResolution(width, height, frame_rate); |
663 } | 647 } |
664 | 648 |
665 void QMVideoSettingsCallback::SetTargetFramerate(int frame_rate) { | 649 void QMVideoSettingsCallback::SetTargetFramerate(int frame_rate) { |
666 vpm_->SetTargetFramerate(frame_rate); | 650 vpm_->SetTargetFramerate(frame_rate); |
667 } | 651 } |
668 | 652 |
669 } // namespace webrtc | 653 } // namespace webrtc |
OLD | NEW |