Skip to content
This repository has been archived by the owner on Mar 15, 2021. It is now read-only.

Commit

Permalink
fix noise issue
Browse files Browse the repository at this point in the history
  • Loading branch information
CatxFish committed Sep 30, 2019
1 parent d77b055 commit 4a01123
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/queue/share_queue_write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,16 @@ bool shared_queue_push_audio(share_queue* q, uint32_t size,
int offset = q->header->header_size +
(q->header->element_size) * q->index;

q->header->write_index = q->index;
q->header->last_ts = video_ts;

uint8_t* buff = (uint8_t*)q->header + offset;
frame_header* head = (frame_header*)buff;
uint8_t* data = (uint8_t*)buff + q->header->element_header_size;
memcpy(data, src, size);
head->linesize[0] = size;
head->timestamp = timestamp;

q->header->last_ts = video_ts;
q->header->write_index = q->index;
q->index++;

if (q->index >= q->header->queue_length) {
Expand Down
4 changes: 3 additions & 1 deletion src/virtual-output/virtual_output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ static bool virtual_output_start(void *data)
output_running = true;
shared_queue_set_delay(&out_data->video_queue, out_data->delay);
shared_queue_set_delay(&out_data->audio_queue, out_data->delay);
start = obs_output_begin_data_capture(out_data->output, 0);


if (audio_running) {
struct audio_convert_info conv = {};
Expand All @@ -124,6 +124,8 @@ static bool virtual_output_start(void *data)
obs_output_set_audio_conversion(out_data->output, &conv);
}

start = obs_output_begin_data_capture(out_data->output, 0);

blog(LOG_INFO, "starting virtual-output on VirtualCam'%d'",
out_data->video_mode + 1);

Expand Down
5 changes: 3 additions & 2 deletions src/virtual-source/virtual-audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,12 @@ HRESULT CVAudioStream::FillBuffer(IMediaSample *pms)
uint64_t timestamp = 0;
REFERENCE_TIME start_time = 0;
REFERENCE_TIME end_time = 0;
long a = 0;


hr = pms->GetPointer((BYTE**)&dst);

if (system_start_time <= 0) {
system_start_time = get_current_time();
a = pms->GetActualDataLength();
}
else
current_time = get_current_time(system_start_time);
Expand All @@ -108,6 +106,9 @@ HRESULT CVAudioStream::FillBuffer(IMediaSample *pms)
if (sync_timeout <= 0) {
SetTimeout();
}
else if(current_time < prev_end_ts)
{
}
else if (current_time - prev_end_ts > sync_timeout) {
if (queue.header)
share_queue_init_index(&queue);
Expand Down

0 comments on commit 4a01123

Please sign in to comment.