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

Side by Side Diff: webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc

Issue 1606613003: Remove extra_options from VideoCodec. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: compile Created 4 years, 11 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
OLDNEW
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
11 #include "webrtc/modules/video_coding/codecs/vp8/vp8_impl.h" 11 #include "webrtc/modules/video_coding/codecs/vp8/vp8_impl.h"
12 12
13 #include <stdlib.h> 13 #include <stdlib.h>
14 #include <string.h> 14 #include <string.h>
15 #include <time.h> 15 #include <time.h>
16 #include <algorithm> 16 #include <algorithm>
17 17
18 // NOTE(ajm): Path provided by gyp. 18 // NOTE(ajm): Path provided by gyp.
19 #include "libyuv/scale.h" // NOLINT 19 #include "libyuv/scale.h" // NOLINT
20 #include "libyuv/convert.h" // NOLINT 20 #include "libyuv/convert.h" // NOLINT
21 21
22 #include "webrtc/base/checks.h" 22 #include "webrtc/base/checks.h"
23 #include "webrtc/base/trace_event.h" 23 #include "webrtc/base/trace_event.h"
24 #include "webrtc/common.h"
25 #include "webrtc/common_types.h" 24 #include "webrtc/common_types.h"
26 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" 25 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
27 #include "webrtc/modules/include/module_common_types.h" 26 #include "webrtc/modules/include/module_common_types.h"
28 #include "webrtc/modules/video_coding/include/video_codec_interface.h" 27 #include "webrtc/modules/video_coding/include/video_codec_interface.h"
29 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h" 28 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h"
30 #include "webrtc/modules/video_coding/codecs/vp8/screenshare_layers.h" 29 #include "webrtc/modules/video_coding/codecs/vp8/screenshare_layers.h"
31 #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h" 30 #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h"
32 #include "webrtc/system_wrappers/include/tick_util.h" 31 #include "webrtc/system_wrappers/include/tick_util.h"
33 32
34 namespace webrtc { 33 namespace webrtc {
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 if (send_stream && !send_stream_[stream_idx]) { 306 if (send_stream && !send_stream_[stream_idx]) {
308 // Need a key frame if we have not sent this stream before. 307 // Need a key frame if we have not sent this stream before.
309 key_frame_request_[stream_idx] = true; 308 key_frame_request_[stream_idx] = true;
310 } 309 }
311 send_stream_[stream_idx] = send_stream; 310 send_stream_[stream_idx] = send_stream;
312 } 311 }
313 312
314 void VP8EncoderImpl::SetupTemporalLayers(int num_streams, 313 void VP8EncoderImpl::SetupTemporalLayers(int num_streams,
315 int num_temporal_layers, 314 int num_temporal_layers,
316 const VideoCodec& codec) { 315 const VideoCodec& codec) {
317 const Config default_options; 316 TemporalLayersFactory default_factory;
318 const TemporalLayers::Factory& tl_factory = 317 const TemporalLayersFactory* tl_factory = codec.codecSpecific.VP8.tl_factory;
319 (codec.extra_options ? codec.extra_options : &default_options) 318 if (!tl_factory)
320 ->Get<TemporalLayers::Factory>(); 319 tl_factory = &default_factory;
321 if (num_streams == 1) { 320 if (num_streams == 1) {
322 if (codec.mode == kScreensharing) { 321 if (codec.mode == kScreensharing) {
323 // Special mode when screensharing on a single stream. 322 // Special mode when screensharing on a single stream.
324 temporal_layers_.push_back( 323 temporal_layers_.push_back(
325 new ScreenshareLayers(num_temporal_layers, rand())); 324 new ScreenshareLayers(num_temporal_layers, rand()));
326 } else { 325 } else {
327 temporal_layers_.push_back( 326 temporal_layers_.push_back(
328 tl_factory.Create(num_temporal_layers, rand())); 327 tl_factory->Create(num_temporal_layers, rand()));
329 } 328 }
330 } else { 329 } else {
331 for (int i = 0; i < num_streams; ++i) { 330 for (int i = 0; i < num_streams; ++i) {
332 // TODO(andresp): crash if layers is invalid. 331 // TODO(andresp): crash if layers is invalid.
333 int layers = codec.simulcastStream[i].numberOfTemporalLayers; 332 int layers = codec.simulcastStream[i].numberOfTemporalLayers;
334 if (layers < 1) 333 if (layers < 1)
335 layers = 1; 334 layers = 1;
336 temporal_layers_.push_back(tl_factory.Create(layers, rand())); 335 temporal_layers_.push_back(tl_factory->Create(layers, rand()));
337 } 336 }
338 } 337 }
339 } 338 }
340 339
341 int VP8EncoderImpl::InitEncode(const VideoCodec* inst, 340 int VP8EncoderImpl::InitEncode(const VideoCodec* inst,
342 int number_of_cores, 341 int number_of_cores,
343 size_t /*maxPayloadSize */) { 342 size_t /*maxPayloadSize */) {
344 if (inst == NULL) { 343 if (inst == NULL) {
345 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; 344 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
346 } 345 }
(...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 return -1; 1393 return -1;
1395 } 1394 }
1396 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) != 1395 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) !=
1397 VPX_CODEC_OK) { 1396 VPX_CODEC_OK) {
1398 return -1; 1397 return -1;
1399 } 1398 }
1400 return 0; 1399 return 0;
1401 } 1400 }
1402 1401
1403 } // namespace webrtc 1402 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/codecs/vp8/temporal_layers.h ('k') | webrtc/modules/video_coding/codecs/vp9/vp9_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698