Fix encoder flags not set properly
This commit is contained in:
@@ -808,7 +808,7 @@ class display_gpu_t : public display_base_t, public std::enable_shared_from_this
|
|||||||
return capture_e::error;
|
return capture_e::error;
|
||||||
}
|
}
|
||||||
|
|
||||||
img->row_pitch = 0;
|
img->row_pitch = width * 4;
|
||||||
img->width = width;
|
img->width = width;
|
||||||
img->height = height;
|
img->height = height;
|
||||||
img->data = (std::uint8_t*)src_p;
|
img->data = (std::uint8_t*)src_p;
|
||||||
@@ -833,18 +833,19 @@ class display_gpu_t : public display_base_t, public std::enable_shared_from_this
|
|||||||
int dummy_img(platf::img_t *img_base, int &dummy_data_p) override {
|
int dummy_img(platf::img_t *img_base, int &dummy_data_p) override {
|
||||||
auto img = (img_d3d_t*)img_base;
|
auto img = (img_d3d_t*)img_base;
|
||||||
|
|
||||||
img->row_pitch = 4;
|
img->row_pitch = width * 4;
|
||||||
D3D11_TEXTURE2D_DESC t {};
|
D3D11_TEXTURE2D_DESC t {};
|
||||||
t.Width = 1;
|
t.Width = width;
|
||||||
t.Height = 1;
|
t.Height = height;
|
||||||
t.MipLevels = 1;
|
t.MipLevels = 1;
|
||||||
t.ArraySize = 1;
|
t.ArraySize = 1;
|
||||||
t.SampleDesc.Count = 1;
|
t.SampleDesc.Count = 1;
|
||||||
t.Usage = D3D11_USAGE_DEFAULT;
|
t.Usage = D3D11_USAGE_DEFAULT;
|
||||||
t.Format = format;
|
t.Format = format;
|
||||||
|
|
||||||
|
auto dummy_data = std::make_unique<int[]>(width * height);
|
||||||
D3D11_SUBRESOURCE_DATA data {
|
D3D11_SUBRESOURCE_DATA data {
|
||||||
&dummy_data_p,
|
dummy_data.get(),
|
||||||
(UINT)img->row_pitch,
|
(UINT)img->row_pitch,
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
@@ -857,8 +858,8 @@ class display_gpu_t : public display_base_t, public std::enable_shared_from_this
|
|||||||
}
|
}
|
||||||
img->texture.reset(tex_p);
|
img->texture.reset(tex_p);
|
||||||
|
|
||||||
img->height = 1;
|
img->height = height;
|
||||||
img->width = 1;
|
img->width = width;
|
||||||
img->data = (std::uint8_t*)tex_p;
|
img->data = (std::uint8_t*)tex_p;
|
||||||
img->pixel_pitch = 4;
|
img->pixel_pitch = 4;
|
||||||
|
|
||||||
|
|||||||
+9
-13
@@ -250,6 +250,7 @@ void captureThread(
|
|||||||
next_frame += delay;
|
next_frame += delay;
|
||||||
|
|
||||||
auto &img = *round_robin++;
|
auto &img = *round_robin++;
|
||||||
|
while(img.use_count() > 1) {}
|
||||||
platf::capture_e status;
|
platf::capture_e status;
|
||||||
{
|
{
|
||||||
auto lg = display_wp.lock();
|
auto lg = display_wp.lock();
|
||||||
@@ -626,6 +627,7 @@ void encode_run(
|
|||||||
// When Moonlight request an IDR frame, send frames even if there is no new captured frame
|
// When Moonlight request an IDR frame, send frames even if there is no new captured frame
|
||||||
if(frame_nr > (key_frame_nr + config.framerate) || images->peek()) {
|
if(frame_nr > (key_frame_nr + config.framerate) || images->peek()) {
|
||||||
if(auto img = images->pop(delay)) {
|
if(auto img = images->pop(delay)) {
|
||||||
|
const platf::img_t *img_p;
|
||||||
if(encoder.system_memory) {
|
if(encoder.system_memory) {
|
||||||
auto new_width = img->width;
|
auto new_width = img->width;
|
||||||
auto new_height = img->height;
|
auto new_height = img->height;
|
||||||
@@ -646,17 +648,16 @@ void encode_run(
|
|||||||
0, 1 << 16, 1 << 16);
|
0, 1 << 16, 1 << 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
encoder.img_to_frame(sws, *img, session->frame);
|
img_p = img;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
auto converted_img = hwdevice_ctx->convert(*img);
|
img_p = hwdevice_ctx->convert(*img);
|
||||||
if(!converted_img) {
|
if(!img_p) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
encoder.img_to_frame(sws, *converted_img, session->frame);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
encoder.img_to_frame(sws, *img_p, session->frame);
|
||||||
}
|
}
|
||||||
else if(images->running()) {
|
else if(images->running()) {
|
||||||
continue;
|
continue;
|
||||||
@@ -843,13 +844,8 @@ bool validate_encoder(encoder_t &encoder) {
|
|||||||
h264.videoFormat = 0;
|
h264.videoFormat = 0;
|
||||||
hevc.videoFormat = 1;
|
hevc.videoFormat = 1;
|
||||||
|
|
||||||
if(validate_config(disp, encoder, h264)) {
|
encoder.h264[flag] = validate_config(disp, encoder, h264);
|
||||||
encoder.h264[flag] = true;
|
encoder.hevc[flag] = validate_config(disp, encoder, hevc);
|
||||||
}
|
|
||||||
|
|
||||||
if(validate_config(disp, encoder, hevc)) {
|
|
||||||
encoder.hevc[flag] = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user