Chromium Code Reviews

Side by Side Diff: webrtc/modules/video_coding/codecs/vp9/vp9_impl.cc

Issue 2480293002: New jitter buffer experiment. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 238 matching lines...)
249 if (inst->VP9().numberOfSpatialLayers > 2) { 249 if (inst->VP9().numberOfSpatialLayers > 2) {
250 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; 250 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
251 } 251 }
252 252
253 int ret_val = Release(); 253 int ret_val = Release();
254 if (ret_val < 0) { 254 if (ret_val < 0) {
255 return ret_val; 255 return ret_val;
256 } 256 }
257 if (encoder_ == NULL) { 257 if (encoder_ == NULL) {
258 encoder_ = new vpx_codec_ctx_t; 258 encoder_ = new vpx_codec_ctx_t;
259 // Random start 16 bits is enough.
260 picture_id_ = static_cast<uint16_t>(rand()) & 0x7FFF; // NOLINT
261 tl0_pic_idx_ = static_cast<uint8_t>(rand()); // NOLINT
stefan-webrtc 2016/11/08 10:41:34 Not clear to me why this change is done, and why i
philipel 2016/11/08 12:28:39 Done.
stefan-webrtc 2016/11/08 14:49:27 The problem is that if we're relying on this chang
philipel 2016/11/10 16:13:53 Fixed in RtpFrameReferenceFinder
259 } 262 }
260 if (config_ == NULL) { 263 if (config_ == NULL) {
261 config_ = new vpx_codec_enc_cfg_t; 264 config_ = new vpx_codec_enc_cfg_t;
262 } 265 }
263 timestamp_ = 0; 266 timestamp_ = 0;
264 if (&codec_ != inst) { 267 if (&codec_ != inst) {
265 codec_ = *inst; 268 codec_ = *inst;
266 } 269 }
267 270
268 num_spatial_layers_ = inst->VP9().numberOfSpatialLayers; 271 num_spatial_layers_ = inst->VP9().numberOfSpatialLayers;
269 num_temporal_layers_ = inst->VP9().numberOfTemporalLayers; 272 num_temporal_layers_ = inst->VP9().numberOfTemporalLayers;
270 if (num_temporal_layers_ == 0) 273 if (num_temporal_layers_ == 0)
271 num_temporal_layers_ = 1; 274 num_temporal_layers_ = 1;
272 275
273 // Random start 16 bits is enough.
274 picture_id_ = static_cast<uint16_t>(rand()) & 0x7FFF; // NOLINT
275 // Allocate memory for encoded image 276 // Allocate memory for encoded image
276 if (encoded_image_._buffer != NULL) { 277 if (encoded_image_._buffer != NULL) {
277 delete[] encoded_image_._buffer; 278 delete[] encoded_image_._buffer;
278 } 279 }
279 encoded_image_._size = CalcBufferSize(kI420, codec_.width, codec_.height); 280 encoded_image_._size = CalcBufferSize(kI420, codec_.width, codec_.height);
280 encoded_image_._buffer = new uint8_t[encoded_image_._size]; 281 encoded_image_._buffer = new uint8_t[encoded_image_._size];
281 encoded_image_._completeFrame = true; 282 encoded_image_._completeFrame = true;
282 // Creating a wrapper to the image - setting image data to NULL. Actual 283 // Creating a wrapper to the image - setting image data to NULL. Actual
283 // pointer will be set in encode. Setting align to 1, as it is meaningless 284 // pointer will be set in encode. Setting align to 1, as it is meaningless
284 // (actual memory is not allocated). 285 // (actual memory is not allocated).
(...skipping 74 matching lines...)
359 config_->ts_rate_decimator[2] = 1; 360 config_->ts_rate_decimator[2] = 1;
360 config_->ts_periodicity = 4; 361 config_->ts_periodicity = 4;
361 config_->ts_layer_id[0] = 0; 362 config_->ts_layer_id[0] = 0;
362 config_->ts_layer_id[1] = 2; 363 config_->ts_layer_id[1] = 2;
363 config_->ts_layer_id[2] = 1; 364 config_->ts_layer_id[2] = 1;
364 config_->ts_layer_id[3] = 2; 365 config_->ts_layer_id[3] = 2;
365 } else { 366 } else {
366 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; 367 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
367 } 368 }
368 369
369 tl0_pic_idx_ = static_cast<uint8_t>(rand()); // NOLINT
370
371 return InitAndSetControlSettings(inst); 370 return InitAndSetControlSettings(inst);
372 } 371 }
373 372
374 int VP9EncoderImpl::NumberOfThreads(int width, 373 int VP9EncoderImpl::NumberOfThreads(int width,
375 int height, 374 int height,
376 int number_of_cores) { 375 int number_of_cores) {
377 // Keep the number of encoder threads equal to the possible number of column 376 // Keep the number of encoder threads equal to the possible number of column
378 // tiles, which is (1, 2, 4, 8). See comments below for VP9E_SET_TILE_COLUMNS. 377 // tiles, which is (1, 2, 4, 8). See comments below for VP9E_SET_TILE_COLUMNS.
379 if (width * height >= 1280 * 720 && number_of_cores > 4) { 378 if (width * height >= 1280 * 720 && number_of_cores > 4) {
380 return 4; 379 return 4;
(...skipping 613 matching lines...)
994 frame_buffer_pool_.ClearPool(); 993 frame_buffer_pool_.ClearPool();
995 inited_ = false; 994 inited_ = false;
996 return WEBRTC_VIDEO_CODEC_OK; 995 return WEBRTC_VIDEO_CODEC_OK;
997 } 996 }
998 997
999 const char* VP9DecoderImpl::ImplementationName() const { 998 const char* VP9DecoderImpl::ImplementationName() const {
1000 return "libvpx"; 999 return "libvpx";
1001 } 1000 }
1002 1001
1003 } // namespace webrtc 1002 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/video_coding/frame_buffer2.cc » ('j') | webrtc/modules/video_coding/frame_buffer2.cc » ('J')

Powered by Google App Engine