| 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 // TODO (pwestin): add a link to the design document describing the generic | 5 // TODO (pwestin): add a link to the design document describing the generic |
| 6 // protocol and the VP8 specific details. | 6 // protocol and the VP8 specific details. |
| 7 #include "media/cast/video_sender/codecs/vp8/vp8_encoder.h" | 7 #include "media/cast/video_sender/codecs/vp8/vp8_encoder.h" |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 raw_image_->stride[VPX_PLANE_Y] = video_frame->stride(VideoFrame::kYPlane); | 140 raw_image_->stride[VPX_PLANE_Y] = video_frame->stride(VideoFrame::kYPlane); |
| 141 raw_image_->stride[VPX_PLANE_U] = video_frame->stride(VideoFrame::kUPlane); | 141 raw_image_->stride[VPX_PLANE_U] = video_frame->stride(VideoFrame::kUPlane); |
| 142 raw_image_->stride[VPX_PLANE_V] = video_frame->stride(VideoFrame::kVPlane); | 142 raw_image_->stride[VPX_PLANE_V] = video_frame->stride(VideoFrame::kVPlane); |
| 143 | 143 |
| 144 uint8 latest_frame_id_to_reference; | 144 uint8 latest_frame_id_to_reference; |
| 145 Vp8Buffers buffer_to_update; | 145 Vp8Buffers buffer_to_update; |
| 146 vpx_codec_flags_t flags = 0; | 146 vpx_codec_flags_t flags = 0; |
| 147 if (key_frame_requested_) { | 147 if (key_frame_requested_) { |
| 148 flags = VPX_EFLAG_FORCE_KF; | 148 flags = VPX_EFLAG_FORCE_KF; |
| 149 // Self reference. | 149 // Self reference. |
| 150 latest_frame_id_to_reference = | 150 latest_frame_id_to_reference = last_encoded_frame_id_ + 1; |
| 151 static_cast<uint8>(last_encoded_frame_id_ + 1); | |
| 152 // We can pick any buffer as buffer_to_update since we update | 151 // We can pick any buffer as buffer_to_update since we update |
| 153 // them all. | 152 // them all. |
| 154 buffer_to_update = kLastBuffer; | 153 buffer_to_update = kLastBuffer; |
| 155 } else { | 154 } else { |
| 156 // Reference all acked frames (buffers). | 155 // Reference all acked frames (buffers). |
| 157 latest_frame_id_to_reference = GetLatestFrameIdToReference(); | 156 latest_frame_id_to_reference = GetLatestFrameIdToReference(); |
| 158 GetCodecReferenceFlags(&flags); | 157 GetCodecReferenceFlags(&flags); |
| 159 buffer_to_update = GetNextBufferToUpdate(); | 158 buffer_to_update = GetNextBufferToUpdate(); |
| 160 GetCodecUpdateFlags(buffer_to_update, &flags); | 159 GetCodecUpdateFlags(buffer_to_update, &flags); |
| 161 } | 160 } |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 float scale_parameter = 0.5; | 371 float scale_parameter = 0.5; |
| 373 uint32 target_pct = optimal_buffer_size_ms * scale_parameter * | 372 uint32 target_pct = optimal_buffer_size_ms * scale_parameter * |
| 374 cast_config_.max_frame_rate / 10; | 373 cast_config_.max_frame_rate / 10; |
| 375 | 374 |
| 376 // Don't go below 3 times the per frame bandwidth. | 375 // Don't go below 3 times the per frame bandwidth. |
| 377 return std::max(target_pct, kMinIntra); | 376 return std::max(target_pct, kMinIntra); |
| 378 } | 377 } |
| 379 | 378 |
| 380 } // namespace cast | 379 } // namespace cast |
| 381 } // namespace media | 380 } // namespace media |
| OLD | NEW |