
Benefits of this is that the send config previously had unclear locking requirements, a lock was used to lock parts parts of it while reconfiguring the VideoEncoder. Primary work was splitting out video streams from config as well as encoder_settings as these change on ReconfigureVideoEncoder. Now threading requirements for both member configs are clear (as they are read-only), and encoder_settings doesn't stay in the config as a stale pointer. CreateVideoSendStream now takes video streams separately as well as the encoder_settings pointer, analogous to ReconfigureVideoEncoder. This change required changing so that pacing is silently enabled when using suspend_below_min_bitrate rather than silently setting it. R=henrik.lundin@webrtc.org, mflodman@webrtc.org, pthatcher@webrtc.org, stefan@webrtc.org BUG=3260 Review URL: https://webrtc-codereview.appspot.com/20409004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6349 4adac7df-926f-26a2-2b94-8c16560cd09d
85 lines
2.8 KiB
C++
85 lines
2.8 KiB
C++
/*
|
|
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
#include "webrtc/test/encoder_settings.h"
|
|
|
|
#include <assert.h>
|
|
#include <string.h>
|
|
|
|
#include "webrtc/video_engine/vie_defines.h"
|
|
|
|
namespace webrtc {
|
|
namespace test {
|
|
std::vector<VideoStream> CreateVideoStreams(size_t num_streams) {
|
|
assert(num_streams > 0);
|
|
|
|
// Add more streams to the settings above with reasonable values if required.
|
|
static const size_t kNumSettings = 3;
|
|
assert(num_streams <= kNumSettings);
|
|
|
|
std::vector<VideoStream> stream_settings(kNumSettings);
|
|
|
|
stream_settings[0].width = 320;
|
|
stream_settings[0].height = 180;
|
|
stream_settings[0].max_framerate = 30;
|
|
stream_settings[0].min_bitrate_bps = 50000;
|
|
stream_settings[0].target_bitrate_bps = stream_settings[0].max_bitrate_bps =
|
|
150000;
|
|
stream_settings[0].max_qp = 56;
|
|
|
|
stream_settings[1].width = 640;
|
|
stream_settings[1].height = 360;
|
|
stream_settings[1].max_framerate = 30;
|
|
stream_settings[1].min_bitrate_bps = 200000;
|
|
stream_settings[1].target_bitrate_bps = stream_settings[1].max_bitrate_bps =
|
|
450000;
|
|
stream_settings[1].max_qp = 56;
|
|
|
|
stream_settings[2].width = 1280;
|
|
stream_settings[2].height = 720;
|
|
stream_settings[2].max_framerate = 30;
|
|
stream_settings[2].min_bitrate_bps = 700000;
|
|
stream_settings[2].target_bitrate_bps = stream_settings[2].max_bitrate_bps =
|
|
1500000;
|
|
stream_settings[2].max_qp = 56;
|
|
stream_settings.resize(num_streams);
|
|
return stream_settings;
|
|
}
|
|
|
|
VideoCodec CreateDecoderVideoCodec(
|
|
const VideoSendStream::Config::EncoderSettings& encoder_settings) {
|
|
VideoCodec codec;
|
|
memset(&codec, 0, sizeof(codec));
|
|
|
|
codec.plType = encoder_settings.payload_type;
|
|
strcpy(codec.plName, encoder_settings.payload_name.c_str());
|
|
codec.codecType =
|
|
(encoder_settings.payload_name == "VP8" ? kVideoCodecVP8
|
|
: kVideoCodecGeneric);
|
|
|
|
if (codec.codecType == kVideoCodecVP8) {
|
|
codec.codecSpecific.VP8.resilience = kResilientStream;
|
|
codec.codecSpecific.VP8.numberOfTemporalLayers = 1;
|
|
codec.codecSpecific.VP8.denoisingOn = true;
|
|
codec.codecSpecific.VP8.errorConcealmentOn = false;
|
|
codec.codecSpecific.VP8.automaticResizeOn = false;
|
|
codec.codecSpecific.VP8.frameDroppingOn = true;
|
|
codec.codecSpecific.VP8.keyFrameInterval = 3000;
|
|
}
|
|
|
|
codec.width = 320;
|
|
codec.height = 180;
|
|
codec.startBitrate = codec.minBitrate = codec.maxBitrate = 300;
|
|
|
|
return codec;
|
|
}
|
|
|
|
} // namespace test
|
|
} // namespace webrtc
|