mirror of
https://github.com/huggingface/lerobot.git
synced 2026-05-23 04:30:10 +00:00
fix(audio chunks): querying audio chunks in the past rather than in the future
This commit is contained in:
@@ -76,7 +76,7 @@ def decode_audio_torchcodec(
|
|||||||
audio_chunks = []
|
audio_chunks = []
|
||||||
for ts in timestamps:
|
for ts in timestamps:
|
||||||
current_audio_chunk = audio_decoder.get_samples_played_in_range(
|
current_audio_chunk = audio_decoder.get_samples_played_in_range(
|
||||||
start_seconds=ts, stop_seconds=ts + duration
|
start_seconds=ts - duration, stop_seconds=ts
|
||||||
)
|
)
|
||||||
|
|
||||||
if log_loaded_timestamps:
|
if log_loaded_timestamps:
|
||||||
@@ -114,7 +114,7 @@ def decode_audio_torchaudio(
|
|||||||
|
|
||||||
audio_chunks = []
|
audio_chunks = []
|
||||||
for ts in timestamps:
|
for ts in timestamps:
|
||||||
reader.seek(ts) # Default to closest audio sample
|
reader.seek(ts - duration) # Default to closest audio sample
|
||||||
status = reader.fill_buffer()
|
status = reader.fill_buffer()
|
||||||
if status != 0:
|
if status != 0:
|
||||||
logging.warning("Audio stream reached end of recording before decoding desired timestamps.")
|
logging.warning("Audio stream reached end of recording before decoding desired timestamps.")
|
||||||
|
|||||||
Reference in New Issue
Block a user