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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 raw_image_->stride[VPX_PLANE_Y] = video_frame->stride(VideoFrame::kYPlane); | 136 raw_image_->stride[VPX_PLANE_Y] = video_frame->stride(VideoFrame::kYPlane); |
137 raw_image_->stride[VPX_PLANE_U] = video_frame->stride(VideoFrame::kUPlane); | 137 raw_image_->stride[VPX_PLANE_U] = video_frame->stride(VideoFrame::kUPlane); |
138 raw_image_->stride[VPX_PLANE_V] = video_frame->stride(VideoFrame::kVPlane); | 138 raw_image_->stride[VPX_PLANE_V] = video_frame->stride(VideoFrame::kVPlane); |
139 | 139 |
140 uint8 latest_frame_id_to_reference; | 140 uint8 latest_frame_id_to_reference; |
141 Vp8Buffers buffer_to_update; | 141 Vp8Buffers buffer_to_update; |
142 vpx_codec_flags_t flags = 0; | 142 vpx_codec_flags_t flags = 0; |
143 if (key_frame_requested_) { | 143 if (key_frame_requested_) { |
144 flags = VPX_EFLAG_FORCE_KF; | 144 flags = VPX_EFLAG_FORCE_KF; |
145 // Self reference. | 145 // Self reference. |
146 latest_frame_id_to_reference = | 146 latest_frame_id_to_reference = last_encoded_frame_id_ + 1; |
147 static_cast<uint8>(last_encoded_frame_id_ + 1); | |
148 // We can pick any buffer as buffer_to_update since we update | 147 // We can pick any buffer as buffer_to_update since we update |
149 // them all. | 148 // them all. |
150 buffer_to_update = kLastBuffer; | 149 buffer_to_update = kLastBuffer; |
151 } else { | 150 } else { |
152 // Reference all acked frames (buffers). | 151 // Reference all acked frames (buffers). |
153 latest_frame_id_to_reference = GetLatestFrameIdToReference(); | 152 latest_frame_id_to_reference = GetLatestFrameIdToReference(); |
154 GetCodecReferenceFlags(&flags); | 153 GetCodecReferenceFlags(&flags); |
155 buffer_to_update = GetNextBufferToUpdate(); | 154 buffer_to_update = GetNextBufferToUpdate(); |
156 GetCodecUpdateFlags(buffer_to_update, &flags); | 155 GetCodecUpdateFlags(buffer_to_update, &flags); |
157 } | 156 } |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 float scale_parameter = 0.5; | 363 float scale_parameter = 0.5; |
365 uint32 target_pct = optimal_buffer_size_ms * scale_parameter * | 364 uint32 target_pct = optimal_buffer_size_ms * scale_parameter * |
366 cast_config_.max_frame_rate / 10; | 365 cast_config_.max_frame_rate / 10; |
367 | 366 |
368 // Don't go below 3 times the per frame bandwidth. | 367 // Don't go below 3 times the per frame bandwidth. |
369 return std::max(target_pct, kMinIntra); | 368 return std::max(target_pct, kMinIntra); |
370 } | 369 } |
371 | 370 |
372 } // namespace cast | 371 } // namespace cast |
373 } // namespace media | 372 } // namespace media |
OLD | NEW |