mirror of
https://github.com/ggml-org/whisper.cpp.git
synced 2026-09-28 17:07:42 -05:00
* Bump version * Add test for VAD segments API * Implement VAD segments API * Add signatures of VAD segments API * Stop to dependent on mutex_m * Check segment range for vad_segment_t0/t1 * Remove needless check * Remove dead codes * Fix index check for VAD segments * Remove needless line * Use NUM2DBL instead of RFLOAT_VALUE for safety * Fix document * Check type of samples * Arrange CMake cache notation for older version * Remove unnecessary line break * Check return value of whisper_vad_segments_from_samples * Fix type of VAD::Segment#start_time and #end_time * Prevent dangling pointer from Params to VAD::Params * Fix typos * Update README * Make test follow fix of impl * Use segments_from_samples_body in ruby_whisper_vad_detect * Run segments_from_samples without GVL * Remove unnecessary codes * [skip ci]Remove trailing whitespace Co-authored-by: Daniel Bevenius <daniel.bevenius@gmail.com> --------- Co-authored-by: Daniel Bevenius <daniel.bevenius@gmail.com>
34 lines
757 B
Ruby
34 lines
757 B
Ruby
module Whisper
|
|
module LogSettable
|
|
private
|
|
|
|
def start_log_callback_thread
|
|
return if @log_callback_thread&.alive?
|
|
|
|
@log_callback_thread = Thread.new {
|
|
begin
|
|
while logs = drain_logs
|
|
begin
|
|
callback, user_data = synchronize {[@log_callback, @log_callback_user_data]}
|
|
next if callback.nil?
|
|
|
|
logs.each do |(level, text)|
|
|
callback.call level, text, user_data
|
|
end
|
|
rescue => err
|
|
$stderr.puts err
|
|
end
|
|
end
|
|
rescue => err
|
|
$stderr.puts err
|
|
end
|
|
}
|
|
end
|
|
|
|
def synchronize(&block)
|
|
@mutex ||= Thread::Mutex.new
|
|
@mutex.synchronize &block
|
|
end
|
|
end
|
|
end
|