OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 encoded_image_._frameType = ConvertToVideoFrameType(info.eFrameType); | 370 encoded_image_._frameType = ConvertToVideoFrameType(info.eFrameType); |
371 | 371 |
372 // Split encoded image up into fragments. This also updates |encoded_image_|. | 372 // Split encoded image up into fragments. This also updates |encoded_image_|. |
373 RTPFragmentationHeader frag_header; | 373 RTPFragmentationHeader frag_header; |
374 RtpFragmentize(&encoded_image_, &encoded_image_buffer_, *frame_buffer, &info, | 374 RtpFragmentize(&encoded_image_, &encoded_image_buffer_, *frame_buffer, &info, |
375 &frag_header); | 375 &frag_header); |
376 | 376 |
377 // Encoder can skip frames to save bandwidth in which case | 377 // Encoder can skip frames to save bandwidth in which case |
378 // |encoded_image_._length| == 0. | 378 // |encoded_image_._length| == 0. |
379 if (encoded_image_._length > 0) { | 379 if (encoded_image_._length > 0) { |
| 380 // Parse QP. |
| 381 h264_bitstream_parser_.ParseBitstream(encoded_image_._buffer, |
| 382 encoded_image_._length); |
| 383 h264_bitstream_parser_.GetLastSliceQp(&encoded_image_.qp_); |
| 384 |
380 // Deliver encoded image. | 385 // Deliver encoded image. |
381 CodecSpecificInfo codec_specific; | 386 CodecSpecificInfo codec_specific; |
382 codec_specific.codecType = kVideoCodecH264; | 387 codec_specific.codecType = kVideoCodecH264; |
383 codec_specific.codecSpecific.H264.packetization_mode = packetization_mode_; | 388 codec_specific.codecSpecific.H264.packetization_mode = packetization_mode_; |
384 encoded_image_callback_->OnEncodedImage(encoded_image_, &codec_specific, | 389 encoded_image_callback_->OnEncodedImage(encoded_image_, &codec_specific, |
385 &frag_header); | 390 &frag_header); |
386 | |
387 // Parse and report QP. | |
388 h264_bitstream_parser_.ParseBitstream(encoded_image_._buffer, | |
389 encoded_image_._length); | |
390 h264_bitstream_parser_.GetLastSliceQp(&encoded_image_.qp_); | |
391 } | 391 } |
392 return WEBRTC_VIDEO_CODEC_OK; | 392 return WEBRTC_VIDEO_CODEC_OK; |
393 } | 393 } |
394 | 394 |
395 const char* H264EncoderImpl::ImplementationName() const { | 395 const char* H264EncoderImpl::ImplementationName() const { |
396 return "OpenH264"; | 396 return "OpenH264"; |
397 } | 397 } |
398 | 398 |
399 bool H264EncoderImpl::IsInitialized() const { | 399 bool H264EncoderImpl::IsInitialized() const { |
400 return openh264_encoder_ != nullptr; | 400 return openh264_encoder_ != nullptr; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 | 494 |
495 int32_t H264EncoderImpl::SetPeriodicKeyFrames(bool enable) { | 495 int32_t H264EncoderImpl::SetPeriodicKeyFrames(bool enable) { |
496 return WEBRTC_VIDEO_CODEC_OK; | 496 return WEBRTC_VIDEO_CODEC_OK; |
497 } | 497 } |
498 | 498 |
499 VideoEncoder::ScalingSettings H264EncoderImpl::GetScalingSettings() const { | 499 VideoEncoder::ScalingSettings H264EncoderImpl::GetScalingSettings() const { |
500 return VideoEncoder::ScalingSettings(true); | 500 return VideoEncoder::ScalingSettings(true); |
501 } | 501 } |
502 | 502 |
503 } // namespace webrtc | 503 } // namespace webrtc |
OLD | NEW |