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 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 assert(codec_specific != NULL); | 805 assert(codec_specific != NULL); |
806 codec_specific->codecType = kVideoCodecVP8; | 806 codec_specific->codecType = kVideoCodecVP8; |
807 codec_specific->codec_name = ImplementationName(); | 807 codec_specific->codec_name = ImplementationName(); |
808 CodecSpecificInfoVP8* vp8Info = &(codec_specific->codecSpecific.VP8); | 808 CodecSpecificInfoVP8* vp8Info = &(codec_specific->codecSpecific.VP8); |
809 vp8Info->pictureId = picture_id_[stream_idx]; | 809 vp8Info->pictureId = picture_id_[stream_idx]; |
810 if (pkt.data.frame.flags & VPX_FRAME_IS_KEY) { | 810 if (pkt.data.frame.flags & VPX_FRAME_IS_KEY) { |
811 last_key_frame_picture_id_[stream_idx] = picture_id_[stream_idx]; | 811 last_key_frame_picture_id_[stream_idx] = picture_id_[stream_idx]; |
812 } | 812 } |
813 vp8Info->simulcastIdx = stream_idx; | 813 vp8Info->simulcastIdx = stream_idx; |
814 vp8Info->keyIdx = kNoKeyIdx; // TODO(hlundin) populate this | 814 vp8Info->keyIdx = kNoKeyIdx; // TODO(hlundin) populate this |
815 vp8Info->nonReference = | 815 vp8Info->nonReference = (pkt.data.frame.flags & VPX_FRAME_IS_DROPPABLE) != 0; |
816 (pkt.data.frame.flags & VPX_FRAME_IS_DROPPABLE) ? true : false; | 816 temporal_layers_[stream_idx]->PopulateCodecSpecific( |
817 bool base_layer_sync_point = pkt.data.frame.flags & VPX_FRAME_IS_KEY; | 817 (pkt.data.frame.flags & VPX_FRAME_IS_KEY) != 0, vp8Info, timestamp); |
818 temporal_layers_[stream_idx]->PopulateCodecSpecific(base_layer_sync_point, | |
819 vp8Info, timestamp); | |
820 // Prepare next. | 818 // Prepare next. |
821 picture_id_[stream_idx] = (picture_id_[stream_idx] + 1) & 0x7FFF; | 819 picture_id_[stream_idx] = (picture_id_[stream_idx] + 1) & 0x7FFF; |
822 } | 820 } |
823 | 821 |
824 int VP8EncoderImpl::GetEncodedPartitions(const VideoFrame& input_image) { | 822 int VP8EncoderImpl::GetEncodedPartitions(const VideoFrame& input_image) { |
825 int bw_resolutions_disabled = | 823 int bw_resolutions_disabled = |
826 (encoders_.size() > 1) ? NumStreamsDisabled(send_stream_) : -1; | 824 (encoders_.size() > 1) ? NumStreamsDisabled(send_stream_) : -1; |
827 | 825 |
828 int stream_idx = static_cast<int>(encoders_.size()) - 1; | 826 int stream_idx = static_cast<int>(encoders_.size()) - 1; |
829 int result = WEBRTC_VIDEO_CODEC_OK; | 827 int result = WEBRTC_VIDEO_CODEC_OK; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 } | 875 } |
878 } | 876 } |
879 encoded_images_[encoder_idx]._timeStamp = input_image.timestamp(); | 877 encoded_images_[encoder_idx]._timeStamp = input_image.timestamp(); |
880 encoded_images_[encoder_idx].capture_time_ms_ = | 878 encoded_images_[encoder_idx].capture_time_ms_ = |
881 input_image.render_time_ms(); | 879 input_image.render_time_ms(); |
882 encoded_images_[encoder_idx].rotation_ = input_image.rotation(); | 880 encoded_images_[encoder_idx].rotation_ = input_image.rotation(); |
883 | 881 |
884 int qp = -1; | 882 int qp = -1; |
885 vpx_codec_control(&encoders_[encoder_idx], VP8E_GET_LAST_QUANTIZER_64, &qp); | 883 vpx_codec_control(&encoders_[encoder_idx], VP8E_GET_LAST_QUANTIZER_64, &qp); |
886 temporal_layers_[stream_idx]->FrameEncoded( | 884 temporal_layers_[stream_idx]->FrameEncoded( |
887 encoded_images_[encoder_idx]._length, | 885 encoded_images_[encoder_idx]._length, qp); |
888 encoded_images_[encoder_idx]._timeStamp, qp); | |
889 if (send_stream_[stream_idx]) { | 886 if (send_stream_[stream_idx]) { |
890 if (encoded_images_[encoder_idx]._length > 0) { | 887 if (encoded_images_[encoder_idx]._length > 0) { |
891 TRACE_COUNTER_ID1("webrtc", "EncodedFrameSize", encoder_idx, | 888 TRACE_COUNTER_ID1("webrtc", "EncodedFrameSize", encoder_idx, |
892 encoded_images_[encoder_idx]._length); | 889 encoded_images_[encoder_idx]._length); |
893 encoded_images_[encoder_idx]._encodedHeight = | 890 encoded_images_[encoder_idx]._encodedHeight = |
894 codec_.simulcastStream[stream_idx].height; | 891 codec_.simulcastStream[stream_idx].height; |
895 encoded_images_[encoder_idx]._encodedWidth = | 892 encoded_images_[encoder_idx]._encodedWidth = |
896 codec_.simulcastStream[stream_idx].width; | 893 codec_.simulcastStream[stream_idx].width; |
897 // Report once per frame (lowest stream always sent). | 894 // Report once per frame (lowest stream always sent). |
898 encoded_images_[encoder_idx].adapt_reason_.bw_resolutions_disabled = | 895 encoded_images_[encoder_idx].adapt_reason_.bw_resolutions_disabled = |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 buffer_pool_.Release(); | 1149 buffer_pool_.Release(); |
1153 inited_ = false; | 1150 inited_ = false; |
1154 return WEBRTC_VIDEO_CODEC_OK; | 1151 return WEBRTC_VIDEO_CODEC_OK; |
1155 } | 1152 } |
1156 | 1153 |
1157 const char* VP8DecoderImpl::ImplementationName() const { | 1154 const char* VP8DecoderImpl::ImplementationName() const { |
1158 return "libvpx"; | 1155 return "libvpx"; |
1159 } | 1156 } |
1160 | 1157 |
1161 } // namespace webrtc | 1158 } // namespace webrtc |
OLD | NEW |