mirror of
https://repo.dec05eba.com/gpu-screen-recorder
synced 2026-05-06 23:06:22 +09:00
Who cares anymore
This commit is contained in:
11
src/main.cpp
11
src/main.cpp
@@ -292,6 +292,7 @@ static AVSampleFormat audio_format_to_sample_format(const AudioFormat audio_form
|
|||||||
}
|
}
|
||||||
|
|
||||||
static AVCodecContext* create_audio_codec_context(int fps, AudioCodec audio_codec, bool mix_audio) {
|
static AVCodecContext* create_audio_codec_context(int fps, AudioCodec audio_codec, bool mix_audio) {
|
||||||
|
(void)fps;
|
||||||
const AVCodec *codec = avcodec_find_encoder(audio_codec_get_id(audio_codec));
|
const AVCodec *codec = avcodec_find_encoder(audio_codec_get_id(audio_codec));
|
||||||
if (!codec) {
|
if (!codec) {
|
||||||
fprintf(stderr, "Error: Could not find %s audio encoder\n", audio_codec_get_name(audio_codec));
|
fprintf(stderr, "Error: Could not find %s audio encoder\n", audio_codec_get_name(audio_codec));
|
||||||
@@ -316,8 +317,6 @@ static AVCodecContext* create_audio_codec_context(int fps, AudioCodec audio_code
|
|||||||
|
|
||||||
codec_context->time_base.num = 1;
|
codec_context->time_base.num = 1;
|
||||||
codec_context->time_base.den = AV_TIME_BASE;
|
codec_context->time_base.den = AV_TIME_BASE;
|
||||||
codec_context->framerate.num = fps;
|
|
||||||
codec_context->framerate.den = 1;
|
|
||||||
codec_context->thread_count = 1;
|
codec_context->thread_count = 1;
|
||||||
codec_context->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
|
codec_context->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
|
||||||
|
|
||||||
@@ -2432,8 +2431,7 @@ int main(int argc, char **argv) {
|
|||||||
audio_device.frame->data[0] = empty_audio;
|
audio_device.frame->data[0] = empty_audio;
|
||||||
|
|
||||||
const int64_t new_pts = (this_audio_frame_time - record_start_time) * AV_TIME_BASE;
|
const int64_t new_pts = (this_audio_frame_time - record_start_time) * AV_TIME_BASE;
|
||||||
if(new_pts == audio_device.frame->pts)
|
if(new_pts != audio_device.frame->pts) {
|
||||||
continue;
|
|
||||||
audio_device.frame->pts = new_pts;
|
audio_device.frame->pts = new_pts;
|
||||||
|
|
||||||
if(audio_track.graph) {
|
if(audio_track.graph) {
|
||||||
@@ -2452,6 +2450,7 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!audio_device.sound_device.handle)
|
if(!audio_device.sound_device.handle)
|
||||||
usleep(no_input_sleep_ms * 1000);
|
usleep(no_input_sleep_ms * 1000);
|
||||||
@@ -2464,8 +2463,7 @@ int main(int argc, char **argv) {
|
|||||||
audio_device.frame->data[0] = (uint8_t*)sound_buffer;
|
audio_device.frame->data[0] = (uint8_t*)sound_buffer;
|
||||||
|
|
||||||
const int64_t new_pts = (this_audio_frame_time - record_start_time) * AV_TIME_BASE;
|
const int64_t new_pts = (this_audio_frame_time - record_start_time) * AV_TIME_BASE;
|
||||||
if(new_pts == audio_device.frame->pts)
|
if(new_pts != audio_device.frame->pts) {
|
||||||
continue;
|
|
||||||
audio_device.frame->pts = new_pts;
|
audio_device.frame->pts = new_pts;
|
||||||
|
|
||||||
if(audio_track.graph) {
|
if(audio_track.graph) {
|
||||||
@@ -2485,6 +2483,7 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(swr)
|
if(swr)
|
||||||
swr_free(&swr);
|
swr_free(&swr);
|
||||||
|
|||||||
Reference in New Issue
Block a user