mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
media_encoder: print encoder name in logs
Refs #68788 Change-Id: Ib9d57ad5bdad7e10d30d11d3369fdf082eb1a999
This commit is contained in:
@ -482,11 +482,18 @@ void MediaEncoder::prepareEncoderContext(bool is_video)
|
||||
encoderCtx_ = avcodec_alloc_context3(outputEncoder_);
|
||||
#endif
|
||||
|
||||
auto encoderName = encoderCtx_->av_class->item_name ?
|
||||
encoderCtx_->av_class->item_name(encoderCtx_) : nullptr;
|
||||
if (encoderName == nullptr)
|
||||
encoderName = "encoder?";
|
||||
|
||||
// set some encoder settings here
|
||||
encoderCtx_->bit_rate = 1000 * atoi(av_dict_get(options_, "bitrate",
|
||||
NULL, 0)->value);
|
||||
RING_DBG("Using bitrate %d", encoderCtx_->bit_rate);
|
||||
RING_DBG("[%s] Using bitrate %d", encoderName, encoderCtx_->bit_rate);
|
||||
|
||||
encoderCtx_->thread_count = std::thread::hardware_concurrency();
|
||||
RING_DBG("[%s] Using %d threads", encoderName, encoderCtx_->thread_count);
|
||||
|
||||
if (is_video) {
|
||||
// resolution must be a multiple of two
|
||||
@ -519,7 +526,7 @@ void MediaEncoder::prepareEncoderContext(bool is_video)
|
||||
encoderCtx_->sample_rate = atoi(v->value);
|
||||
encoderCtx_->time_base = (AVRational) {1, encoderCtx_->sample_rate};
|
||||
} else {
|
||||
RING_WARN("No sample rate set");
|
||||
RING_WARN("[%s] No sample rate set", encoderName);
|
||||
encoderCtx_->sample_rate = 8000;
|
||||
}
|
||||
|
||||
@ -527,12 +534,12 @@ void MediaEncoder::prepareEncoderContext(bool is_video)
|
||||
if (v) {
|
||||
auto c = std::atoi(v->value);
|
||||
if (c > 2 or c < 1) {
|
||||
RING_WARN("Clamping invalid channel value %d", c);
|
||||
RING_WARN("[%s] Clamping invalid channel value %d", encoderName, c);
|
||||
c = 1;
|
||||
}
|
||||
encoderCtx_->channels = c;
|
||||
} else {
|
||||
RING_WARN("Channels not set");
|
||||
RING_WARN("[%s] Channels not set", encoderName);
|
||||
encoderCtx_->channels = 1;
|
||||
}
|
||||
|
||||
@ -541,9 +548,9 @@ void MediaEncoder::prepareEncoderContext(bool is_video)
|
||||
v = av_dict_get(options_, "frame_size", NULL, 0);
|
||||
if (v) {
|
||||
encoderCtx_->frame_size = atoi(v->value);
|
||||
RING_WARN("Frame size %d", encoderCtx_->frame_size);
|
||||
RING_WARN("[%s] Frame size %d", encoderName, encoderCtx_->frame_size);
|
||||
} else {
|
||||
RING_WARN("Frame size not set");
|
||||
RING_WARN("[%s] Frame size not set", encoderName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user