|
@@ -5,10 +5,11 @@ void image_streamer::impl::create_encoder() {
|
|
|
switch (chose_encoder_type) {
|
|
switch (chose_encoder_type) {
|
|
|
case ENCODER_NVENC: {
|
|
case ENCODER_NVENC: {
|
|
|
auto img_info = OBJ_QUERY(image_u8c4, conf.img_name)->as_info();
|
|
auto img_info = OBJ_QUERY(image_u8c4, conf.img_name)->as_info();
|
|
|
|
|
+ int img_freq = std::round(OBJ_STATS(conf.img_name).save_frequency);
|
|
|
|
|
|
|
|
auto enc_conf = encoder_nvenc::create_config();
|
|
auto enc_conf = encoder_nvenc::create_config();
|
|
|
enc_conf.frame_size = img_info.size;
|
|
enc_conf.frame_size = img_info.size;
|
|
|
- enc_conf.frame_rate = 30; // TODO: determine in runtime
|
|
|
|
|
|
|
+ enc_conf.frame_rate = img_freq;
|
|
|
enc_conf.bitrate_mbps = enc_bitrate_mbps;
|
|
enc_conf.bitrate_mbps = enc_bitrate_mbps;
|
|
|
enc_conf.save_file = enc_save_file;
|
|
enc_conf.save_file = enc_save_file;
|
|
|
enc_conf.save_length = enc_save_length;
|
|
enc_conf.save_length = enc_save_length;
|
|
@@ -31,7 +32,7 @@ void image_streamer::impl::create_sender() {
|
|
|
assert(aux_ctx != nullptr);
|
|
assert(aux_ctx != nullptr);
|
|
|
sender_ctx = aux_ctx.get();
|
|
sender_ctx = aux_ctx.get();
|
|
|
} else {
|
|
} else {
|
|
|
- sender_ctx = main_ctx;
|
|
|
|
|
|
|
+ sender_ctx = ctx;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
assert(sender == nullptr);
|
|
assert(sender == nullptr);
|
|
@@ -63,7 +64,7 @@ void image_streamer::impl::create_sender() {
|
|
|
|
|
|
|
|
if (enable_aux_thread) {
|
|
if (enable_aux_thread) {
|
|
|
sender->sig_req_idr.connect([this] {
|
|
sender->sig_req_idr.connect([this] {
|
|
|
- post(*main_ctx, [this] {
|
|
|
|
|
|
|
+ post(*ctx, [this] {
|
|
|
enc_idr_requested = true;
|
|
enc_idr_requested = true;
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -230,11 +231,11 @@ void image_streamer::impl::show() {
|
|
|
ImGui::SeparatorText("Actions");
|
|
ImGui::SeparatorText("Actions");
|
|
|
if (!is_running) {
|
|
if (!is_running) {
|
|
|
if (ImGui::Button("Start")) {
|
|
if (ImGui::Button("Start")) {
|
|
|
- post(*main_ctx, [this] { start(); });
|
|
|
|
|
|
|
+ post(*ctx, [this] { start(); });
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
if (ImGui::Button("Close")) {
|
|
if (ImGui::Button("Close")) {
|
|
|
- post(*main_ctx, [this] { stop(); });
|
|
|
|
|
|
|
+ post(*ctx, [this] { stop(); });
|
|
|
}
|
|
}
|
|
|
ImGui::SameLine();
|
|
ImGui::SameLine();
|
|
|
if (ImGui::Button("Request IDR")) {
|
|
if (ImGui::Button("Request IDR")) {
|
|
@@ -245,8 +246,7 @@ void image_streamer::impl::show() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
image_streamer::image_streamer(create_config conf)
|
|
image_streamer::image_streamer(create_config conf)
|
|
|
- : pimpl(std::make_unique<impl>()) {
|
|
|
|
|
- pimpl->conf = conf;
|
|
|
|
|
|
|
+ : pimpl(std::make_unique<impl>(conf)) {
|
|
|
pimpl->q_this = this;
|
|
pimpl->q_this = this;
|
|
|
}
|
|
}
|
|
|
|
|
|