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

Side by Side Diff: webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.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) 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
11 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h" 11 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h"
12 12
13 #include <algorithm> 13 #include <algorithm>
14 14
15 // NOTE(ajm): Path provided by gyp. 15 // NOTE(ajm): Path provided by gyp.
16 #include "libyuv/scale.h" // NOLINT 16 #include "libyuv/scale.h" // NOLINT
17 17
18 #include "webrtc/base/checks.h" 18 #include "webrtc/base/checks.h"
19 #include "webrtc/common.h"
20 #include "webrtc/modules/video_coding/codecs/vp8/screenshare_layers.h" 19 #include "webrtc/modules/video_coding/codecs/vp8/screenshare_layers.h"
21 20
22 namespace { 21 namespace {
23 22
24 const unsigned int kDefaultMinQp = 2; 23 const unsigned int kDefaultMinQp = 2;
25 const unsigned int kDefaultMaxQp = 56; 24 const unsigned int kDefaultMaxQp = 56;
26 // Max qp for lowest spatial resolution when doing simulcast. 25 // Max qp for lowest spatial resolution when doing simulcast.
27 const unsigned int kLowestResMaxQp = 45; 26 const unsigned int kLowestResMaxQp = 45;
28 27
29 uint32_t SumStreamTargetBitrate(int streams, const webrtc::VideoCodec& codec) { 28 uint32_t SumStreamTargetBitrate(int streams, const webrtc::VideoCodec& codec) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 if (inst->codecSpecific.VP8.automaticResizeOn && 87 if (inst->codecSpecific.VP8.automaticResizeOn &&
89 inst->numberOfSimulcastStreams > 1) { 88 inst->numberOfSimulcastStreams > 1) {
90 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; 89 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
91 } 90 }
92 return WEBRTC_VIDEO_CODEC_OK; 91 return WEBRTC_VIDEO_CODEC_OK;
93 } 92 }
94 93
95 // TL1 FrameDropper's max time to drop frames. 94 // TL1 FrameDropper's max time to drop frames.
96 const float kTl1MaxTimeToDropFrames = 20.0f; 95 const float kTl1MaxTimeToDropFrames = 20.0f;
97 96
98 struct ScreenshareTemporalLayersFactory : webrtc::TemporalLayers::Factory { 97 struct ScreenshareTemporalLayersFactory : webrtc::TemporalLayersFactory {
99 ScreenshareTemporalLayersFactory() 98 ScreenshareTemporalLayersFactory()
100 : tl1_frame_dropper_(kTl1MaxTimeToDropFrames) {} 99 : tl1_frame_dropper_(kTl1MaxTimeToDropFrames) {}
101 100
102 virtual ~ScreenshareTemporalLayersFactory() {} 101 virtual ~ScreenshareTemporalLayersFactory() {}
103 102
104 virtual webrtc::TemporalLayers* Create(int num_temporal_layers, 103 virtual webrtc::TemporalLayers* Create(int num_temporal_layers,
105 uint8_t initial_tl0_pic_idx) const { 104 uint8_t initial_tl0_pic_idx) const {
106 return new webrtc::ScreenshareLayers(num_temporal_layers, rand()); 105 return new webrtc::ScreenshareLayers(num_temporal_layers, rand());
107 } 106 }
108 107
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 bool doing_simulcast = (number_of_streams > 1); 181 bool doing_simulcast = (number_of_streams > 1);
183 182
184 if (doing_simulcast && !ValidSimulcastResolutions(*inst, number_of_streams)) { 183 if (doing_simulcast && !ValidSimulcastResolutions(*inst, number_of_streams)) {
185 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; 184 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
186 } 185 }
187 186
188 codec_ = *inst; 187 codec_ = *inst;
189 188
190 // Special mode when screensharing on a single stream. 189 // Special mode when screensharing on a single stream.
191 if (number_of_streams == 1 && inst->mode == kScreensharing) { 190 if (number_of_streams == 1 && inst->mode == kScreensharing) {
192 screensharing_extra_options_.reset(new Config()); 191 screensharing_tl_factory_.reset(new ScreenshareTemporalLayersFactory());
193 screensharing_extra_options_->Set<TemporalLayers::Factory>( 192 codec_.codecSpecific.VP8.tl_factory = screensharing_tl_factory_.get();
194 new ScreenshareTemporalLayersFactory());
195 codec_.extra_options = screensharing_extra_options_.get();
196 } 193 }
197 194
198 // Create |number_of_streams| of encoder instances and init them. 195 // Create |number_of_streams| of encoder instances and init them.
199 for (int i = 0; i < number_of_streams; ++i) { 196 for (int i = 0; i < number_of_streams; ++i) {
200 VideoCodec stream_codec; 197 VideoCodec stream_codec;
201 bool send_stream = true; 198 bool send_stream = true;
202 if (!doing_simulcast) { 199 if (!doing_simulcast) {
203 stream_codec = codec_; 200 stream_codec = codec_;
204 stream_codec.numberOfSimulcastStreams = 1; 201 stream_codec.numberOfSimulcastStreams = 1;
205 } else { 202 } else {
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 } 494 }
498 495
499 const char* SimulcastEncoderAdapter::ImplementationName() const { 496 const char* SimulcastEncoderAdapter::ImplementationName() const {
500 // We should not be calling this method before streaminfos_ are configured. 497 // We should not be calling this method before streaminfos_ are configured.
501 RTC_DCHECK(!streaminfos_.empty()); 498 RTC_DCHECK(!streaminfos_.empty());
502 // TODO(pbos): Support multiple implementation names for different encoders. 499 // TODO(pbos): Support multiple implementation names for different encoders.
503 return streaminfos_[0].encoder->ImplementationName(); 500 return streaminfos_[0].encoder->ImplementationName();
504 } 501 }
505 502
506 } // namespace webrtc 503 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698