X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=mixer.cpp;h=ce00bd41a3454fbfaa579349fa4f4b75c59a6beb;hb=35efc9e3149028e6c65dceb46f60490448dcbd9f;hp=31277f1cd87af1bf2e03a67a1f169dcdf8f8c03a;hpb=fa0b850bb90894ae9686e0ad7a17ed1b2aafb5d1;p=nageru diff --git a/mixer.cpp b/mixer.cpp index 31277f1..ce00bd4 100644 --- a/mixer.cpp +++ b/mixer.cpp @@ -729,7 +729,9 @@ void Mixer::bm_frame(unsigned card_index, uint16_t timecode, } while (!success); } - audio_mixer.add_audio(device, audio_frame.data + audio_offset, num_samples, audio_format, frame_length, audio_frame.received_timestamp); + if (num_samples > 0) { + audio_mixer.add_audio(device, audio_frame.data + audio_offset, num_samples, audio_format, frame_length, audio_frame.received_timestamp); + } // Done with the audio, so release it. if (audio_frame.owner) { @@ -738,11 +740,6 @@ void Mixer::bm_frame(unsigned card_index, uint16_t timecode, card->last_timecode = timecode; - // Calculate jitter for this card here. We do it on arrival so that we - // make sure every frame counts, even the dropped ones -- and it will also - // make sure the jitter number is as recent as possible, should it change. - card->jitter_history.frame_arrived(video_frame.received_timestamp, frame_length, dropped_frames); - PBOFrameAllocator::Userdata *userdata = (PBOFrameAllocator::Userdata *)video_frame.userdata; size_t cbcr_width, cbcr_height, cbcr_offset, y_offset; @@ -786,8 +783,9 @@ void Mixer::bm_frame(unsigned card_index, uint16_t timecode, new_frame.dropped_frames = dropped_frames; new_frame.received_timestamp = video_frame.received_timestamp; card->new_frames.push_back(move(new_frame)); - card->new_frames_changed.notify_all(); + card->jitter_history.frame_arrived(video_frame.received_timestamp, frame_length, dropped_frames); } + card->new_frames_changed.notify_all(); return; } @@ -911,8 +909,9 @@ void Mixer::bm_frame(unsigned card_index, uint16_t timecode, new_frame.dropped_frames = dropped_frames; new_frame.received_timestamp = video_frame.received_timestamp; // Ignore the audio timestamp. card->new_frames.push_back(move(new_frame)); - card->new_frames_changed.notify_all(); + card->jitter_history.frame_arrived(video_frame.received_timestamp, frame_length, dropped_frames); } + card->new_frames_changed.notify_all(); } }