Audio speed - nova-video-player/aos-AVP GitHub Wiki

  • 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?
  • 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: TODO why should it be changed??? called by stream_video:_parser_thread and used to modify vtime_parsed/vcurrent_rate and atime_parsed/acurrent_rate TODO where is it used and should it be scaled?
  • 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
    • TOCHECK no modification there
  • 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_time increments/decrements are mspf/as
    • TOCHECK check sink_ref_time vs. vid_ref_time
  • From stream_sink
    • nothing is done there