Skip to content

Commit 59f8c91

Browse files
committed
Fix raise on nil start time
1 parent b2e44a5 commit 59f8c91

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

lib/ex_webrtc_recorder/converter.ex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ defmodule ExWebRTC.Recorder.Converter do
232232
end)
233233

234234
# FIXME: This won't work if we have audio/video only
235+
IO.inspect(stream_map, label: :STREAM_MAP_IS)
236+
235237
for {stream_id, %{video: video_files, audio: audio_files}} <- stream_map,
236238
{rid, %{filename: video_file, start_time: video_start}} <- video_files,
237239
{nil, %{filename: audio_file, start_time: audio_start}} <- audio_files,

lib/ex_webrtc_recorder/converter/ffmpeg.ex

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ defmodule ExWebRTC.Recorder.Converter.FFmpeg do
5050
round(duration_seconds)
5151
end
5252

53+
defp calculate_start_times(video_start_ms, audio_start_ms)
54+
when is_nil(video_start_ms) or is_nil(audio_start_ms) do
55+
{"00:00:00.000", "00:00:00.000"}
56+
end
57+
5358
defp calculate_start_times(video_start_ms, audio_start_ms) do
5459
diff = abs(video_start_ms - audio_start_ms)
5560
s = div(diff, 1000)

0 commit comments

Comments
 (0)