Skip to content
CourvilleSoftware edited this page Oct 27, 2024 · 9 revisions
  • Design:
    • timestamps derivation are not changed by audio_speed
    • when audio_speed>1, parser is outputting audio/video quicker with smaller time units
    • this means realtime=stream->video_time*audio_speed to scale it back to real value, and conversely stream->video_time=real_time/audio_speed
  • Notations:
    • rt := real video|audio time
    • as := audio speed (2x -> 2.0f), 0.25<=as<=2.00 (audio_interface_get_audio_speed())
    • mspf := milli seconds per frame (s->video->msPerFrame)
  • QUESTIONS
    • should video->bytesPerSec be scaled too? It should not because it represents real data rate.
  • From audio_interface_audiotrack_java
    • sets the audio speed and configures PlayParams of AudioTrack to set/change output audio rate without pitch
  • From stream_parser:
    • _get_XXX_cdata: chunck data cdata->time is rt/as
    • _get_XXX_time: time is rt
    • GET_XXX_TS: timestamps are rt
    • _seek: need to seek to _get_XXX_time/as i.e. rt/as
    • _calc_rate: no scaling should be applied because time difference should be in real time (RT) (it is called by stream_video:_parser_thread and used to modify vtime_parsed/vcurrent_rate and atime_parsed/acurrent_rate)
  • From stream
    • stream_set_av_speed is called for a change of as and sets AudioTrack audio speed via audio_interface_change_audio_speed and stream_seek_time to current stream rt i.e. stream_get_current_time with STREAM_SEEK_BACKWARD
  • From stream_video
    • _output_frame_no_resize: s->video_time and s->sink_ref_time are rt/as and increments are (mspf/as)
    • stream_get_time_default: returns rt
    • QUESTION in _real_time there is s->speed concept that could be used instead with mult & div?
    • QUESTION _put_frame_in_sink calls _real_time, should it be updated to take as?
    • TOCHECK _video_decode this is where frame_time is set
  • From stream_audio
    • no modification there which is normal
  • From stream_subtitles
    • _sub_decode for internal subs operates on cdata->time thus requires s->video_time and not rt but external subs operate on rt and thus requires as*s->video_time
  • From stream_sync
    • _output_frame_no_resize s->sink_ref_timeincrements/decrements are mspf/as
    • sink_ref_time (manage frame output timing to sink, adjusted on frame drop or double logic and scaled by as) vs. vid_ref_time (used to manage video frames reference time and converts frame time to real time based on playback speed)
  • From stream_sink
    • nothing is done there
Clone this wiki locally