Skip to content

Commit 73cb087

Browse files
committed
better error message when filtering decoder
1 parent 7c221cd commit 73cb087

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/utils.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ enum AVPixelFormat ros_to_av_pix_format(const std::string & ros_pix_fmt)
213213
const auto it = ros_to_av_pix_map.find(ros_pix_fmt);
214214
if (it == ros_to_av_pix_map.end()) {
215215
RCLCPP_ERROR_STREAM(
216-
rclcpp::get_logger("encoder"), "no AV pixel format known for ros format " << ros_pix_fmt);
216+
rclcpp::get_logger("encoder/decoder"),
217+
"no AV pixel format known for ros format " << ros_pix_fmt);
217218
throw(std::runtime_error("no matching pixel format found for: " + ros_pix_fmt));
218219
}
219220
return (it->second);
@@ -314,11 +315,19 @@ std::string filter_decoders(const std::string & codec, const std::string & decod
314315
std::string filtered;
315316
const auto valid_decoders = split_by_char(find_decoders(codec), ',');
316317
for (const auto & dec : split_by_char(decoders, ',')) {
318+
bool found = false;
317319
for (const auto & valid : valid_decoders) {
318320
if (dec == valid) {
319321
filtered += (filtered.empty() ? "" : ",") + dec;
322+
found = true;
323+
break;
320324
}
321325
}
326+
if (!found) {
327+
RCLCPP_WARN_STREAM(
328+
rclcpp::get_logger("encoder/decoder"),
329+
"ignoring invalid decoder " << dec << " for codec " << codec);
330+
}
322331
}
323332
return (filtered);
324333
}

0 commit comments

Comments
 (0)