Commit 4ce478c4 authored by Adrien Béraud's avatar Adrien Béraud

accel: avoid copies

Change-Id: I1c73a1db2636255f2c9912c8922b752e519b0ada
parent 9e9570bd
......@@ -46,10 +46,13 @@ extern "C" {
#include <json/json.h>
#include <sstream>
#include <thread> // hardware_concurrency
#include <string_view>
// Define following line if you need to debug libav SDP
//#define DEBUG_SDP 1
using namespace std::literals;
namespace jami {
constexpr double LOGREG_PARAM_A {79};
......@@ -979,17 +982,17 @@ MediaEncoder::initH263(AVCodecContext* encoderCtx, uint64_t br)
void
MediaEncoder::initAccel(AVCodecContext* encoderCtx, uint64_t br)
{
if (!accel_)
if (not accel_)
return;
if (accel_->getName() == "nvenc") {
if (accel_->getName() == "nvenc"sv) {
// Use same parameters as software
} else if (accel_->getName() == "vaapi") {
} else if (accel_->getName() == "vaapi"sv) {
// Use VBR encoding with bitrate target set to 80% of the maxrate
av_opt_set_int(encoderCtx, "crf", -1, AV_OPT_SEARCH_CHILDREN);
av_opt_set_int(encoderCtx, "b", br * 1000 * 0.8f, AV_OPT_SEARCH_CHILDREN);
} else if (accel_->getName() == "videotoolbox") {
} else if (accel_->getName() == "videotoolbox"sv) {
// Use same parameters as software
} else if (accel_->getName() == "qsv") {
} else if (accel_->getName() == "qsv"sv) {
// Use Video Conferencing Mode
av_opt_set_int(encoderCtx, "vcm", 1, AV_OPT_SEARCH_CHILDREN);
av_opt_set_int(encoderCtx, "b", br * 1000 * 0.8f, AV_OPT_SEARCH_CHILDREN);
......
......@@ -83,7 +83,7 @@ public:
/**
* @brief Name of the hardware layer/API being used.
*/
std::string getName() const { return name_; };
const std::string& getName() const { return name_; };
/**
* @brief Hardware format.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment