Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: trunk/src/media/cast/video_sender/codecs/vp8/vp8_encoder.cc

Issue 25546003: Revert 226264 "Be able to build cast_unittest and related target..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 return false; 154 return false;
155 } 155 }
156 timestamp_ += duration; 156 timestamp_ += duration;
157 157
158 // Get encoded frame. 158 // Get encoded frame.
159 const vpx_codec_cx_pkt_t *pkt = NULL; 159 const vpx_codec_cx_pkt_t *pkt = NULL;
160 vpx_codec_iter_t iter = NULL; 160 vpx_codec_iter_t iter = NULL;
161 int total_size = 0; 161 int total_size = 0;
162 while ((pkt = vpx_codec_get_cx_data(encoder_, &iter)) != NULL) { 162 while ((pkt = vpx_codec_get_cx_data(encoder_, &iter)) != NULL) {
163 if (pkt->kind == VPX_CODEC_CX_FRAME_PKT) { 163 if (pkt->kind == VPX_CODEC_CX_FRAME_PKT) {
164 total_size += static_cast<int>(pkt->data.frame.sz); 164 total_size += pkt->data.frame.sz;
165 encoded_image->data.reserve(total_size); 165 encoded_image->data.reserve(total_size);
166 encoded_image->data.insert( 166 encoded_image->data.insert(
167 encoded_image->data.end(), 167 encoded_image->data.end(),
168 static_cast<const uint8*>(pkt->data.frame.buf), 168 static_cast<const uint8*>(pkt->data.frame.buf),
169 static_cast<const uint8*>(pkt->data.frame.buf) + 169 static_cast<const uint8*>(pkt->data.frame.buf) +
170 pkt->data.frame.sz); 170 pkt->data.frame.sz);
171 if (pkt->data.frame.flags & VPX_FRAME_IS_KEY) { 171 if (pkt->data.frame.flags & VPX_FRAME_IS_KEY) {
172 encoded_image->key_frame = true; 172 encoded_image->key_frame = true;
173 } else { 173 } else {
174 encoded_image->key_frame = false; 174 encoded_image->key_frame = false;
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 float scale_parameter = 0.5; 343 float scale_parameter = 0.5;
344 uint32 target_pct = optimal_buffer_size_ms * scale_parameter * 344 uint32 target_pct = optimal_buffer_size_ms * scale_parameter *
345 cast_config_.max_frame_rate / 10; 345 cast_config_.max_frame_rate / 10;
346 346
347 // Don't go below 3 times the per frame bandwidth. 347 // Don't go below 3 times the per frame bandwidth.
348 return std::max(target_pct, kMinIntra); 348 return std::max(target_pct, kMinIntra);
349 } 349 }
350 350
351 } // namespace cast 351 } // namespace cast
352 } // namespace media 352 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698