New upstream version 24.0.1+dfsg1
This commit is contained in:
parent
b14f9eae6d
commit
5a730d6ec3
842 changed files with 42245 additions and 33385 deletions
|
|
@ -86,6 +86,9 @@ static void *gpu_encode_thread(void *unused)
|
|||
}
|
||||
}
|
||||
|
||||
if (video_pause_check(&encoder->pause, timestamp))
|
||||
continue;
|
||||
|
||||
if (!encoder->start_ts)
|
||||
encoder->start_ts = timestamp;
|
||||
|
||||
|
|
@ -95,11 +98,11 @@ static void *gpu_encode_thread(void *unused)
|
|||
next_key++;
|
||||
|
||||
success = encoder->info.encode_texture(
|
||||
encoder->context.data, tf.handle,
|
||||
encoder->cur_pts, lock_key, &next_key,
|
||||
&pkt, &received);
|
||||
encoder->context.data, tf.handle,
|
||||
encoder->cur_pts, lock_key, &next_key, &pkt,
|
||||
&received);
|
||||
send_off_encoder_packet(encoder, success, received,
|
||||
&pkt);
|
||||
&pkt);
|
||||
|
||||
lock_key = next_key;
|
||||
|
||||
|
|
@ -114,14 +117,13 @@ static void *gpu_encode_thread(void *unused)
|
|||
|
||||
if (--tf.count) {
|
||||
tf.timestamp += interval;
|
||||
circlebuf_push_front(&video->gpu_encoder_queue,
|
||||
&tf, sizeof(tf));
|
||||
circlebuf_push_front(&video->gpu_encoder_queue, &tf,
|
||||
sizeof(tf));
|
||||
|
||||
video_output_inc_texture_skipped_frames(video->video);
|
||||
} else {
|
||||
circlebuf_push_back(
|
||||
&video->gpu_encoder_avail_queue,
|
||||
&tf, sizeof(tf));
|
||||
circlebuf_push_back(&video->gpu_encoder_avail_queue,
|
||||
&tf, sizeof(tf));
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&video->gpu_encoder_mutex);
|
||||
|
|
@ -152,10 +154,9 @@ bool init_gpu_encoding(struct obs_core_video *video)
|
|||
gs_texture_t *tex;
|
||||
gs_texture_t *tex_uv;
|
||||
|
||||
gs_texture_create_nv12(
|
||||
&tex, &tex_uv,
|
||||
ovi->output_width, ovi->output_height,
|
||||
GS_RENDER_TARGET | GS_SHARED_KM_TEX);
|
||||
gs_texture_create_nv12(&tex, &tex_uv, ovi->output_width,
|
||||
ovi->output_height,
|
||||
GS_RENDER_TARGET | GS_SHARED_KM_TEX);
|
||||
if (!tex) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -163,21 +164,19 @@ bool init_gpu_encoding(struct obs_core_video *video)
|
|||
uint32_t handle = gs_texture_get_shared_handle(tex);
|
||||
|
||||
struct obs_tex_frame frame = {
|
||||
.tex = tex,
|
||||
.tex_uv = tex_uv,
|
||||
.handle = handle
|
||||
};
|
||||
.tex = tex, .tex_uv = tex_uv, .handle = handle};
|
||||
|
||||
circlebuf_push_back(&video->gpu_encoder_avail_queue, &frame,
|
||||
sizeof(frame));
|
||||
sizeof(frame));
|
||||
}
|
||||
|
||||
if (os_sem_init(&video->gpu_encode_semaphore, 0) != 0)
|
||||
return false;
|
||||
if (os_event_init(&video->gpu_encode_inactive, OS_EVENT_TYPE_MANUAL) != 0)
|
||||
if (os_event_init(&video->gpu_encode_inactive, OS_EVENT_TYPE_MANUAL) !=
|
||||
0)
|
||||
return false;
|
||||
if (pthread_create(&video->gpu_encode_thread, NULL,
|
||||
gpu_encode_thread, NULL) != 0)
|
||||
if (pthread_create(&video->gpu_encode_thread, NULL, gpu_encode_thread,
|
||||
NULL) != 0)
|
||||
return false;
|
||||
|
||||
os_event_signal(video->gpu_encode_inactive);
|
||||
|
|
@ -211,15 +210,15 @@ void free_gpu_encoding(struct obs_core_video *video)
|
|||
video->gpu_encode_inactive = NULL;
|
||||
}
|
||||
|
||||
#define free_circlebuf(x) \
|
||||
do { \
|
||||
while (x.size) { \
|
||||
struct obs_tex_frame frame; \
|
||||
#define free_circlebuf(x) \
|
||||
do { \
|
||||
while (x.size) { \
|
||||
struct obs_tex_frame frame; \
|
||||
circlebuf_pop_front(&x, &frame, sizeof(frame)); \
|
||||
gs_texture_destroy(frame.tex); \
|
||||
gs_texture_destroy(frame.tex_uv); \
|
||||
} \
|
||||
circlebuf_free(&x); \
|
||||
gs_texture_destroy(frame.tex); \
|
||||
gs_texture_destroy(frame.tex_uv); \
|
||||
} \
|
||||
circlebuf_free(&x); \
|
||||
} while (false)
|
||||
|
||||
free_circlebuf(video->gpu_encoder_queue);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue