File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -38,10 +38,11 @@ def __init__(
3838 ) = get_and_validate_stream_metadata (
3939 decoder = self ._decoder , stream_index = stream_index , media_type = "audio"
4040 )
41+ assert isinstance (self .metadata , core .AudioStreamMetadata ) # mypy
4142
4243 def get_samples_played_in_range (
4344 self , start_seconds : float , stop_seconds : Optional [float ] = None
44- ) -> Tensor :
45+ ) -> AudioSamples :
4546 """TODO-AUDIO docs"""
4647 if stop_seconds is not None and not start_seconds <= stop_seconds :
4748 raise ValueError (
@@ -76,8 +77,12 @@ def get_samples_played_in_range(
7677
7778 # TODO: sample_rate is either the original one from metadata, or the
7879 # user-specified one (NIY)
80+ assert isinstance (self .metadata , core .AudioStreamMetadata ) # mypy
7981 sample_rate = self .metadata .sample_rate
8082
83+ # TODO: metadata's sample_rate should probably not be Optional
84+ assert sample_rate is not None # mypy.
85+
8186 if first_pts < start_seconds :
8287 offset_beginning = round ((start_seconds - first_pts ) * sample_rate )
8388 output_pts_seconds = start_seconds
You can’t perform that action at this time.
0 commit comments