On 6/13/23 11:35 AM, Paul B Mahol wrote: > Doing allocation in probe? > Probing should be very fast. In line 143 of the avformat patch, memory allocation is removed from the probe >>+int dtsuhd_frame(DTSUHD *h, const uint8_t *data, size_t data_bytes, >>+ DTSUHDFrameInfo *fi, DTSUHDDescriptorInfo *di) >>+{ >>+ gb = &h->gb; >>+ init_get_bits(gb, data, data_bytes * 8); > init_get_bits8, and check return code. In line 986 of the avcodec patch, changed to using init_get_bits8 and added return code check. >>+ fi->sync = h->is_sync_frame; >>+ fi->frame_bytes = h->frame_bytes; >>+ fi->sample_rate = h->sample_rate; >>+ fi->sample_count = (h->frame_duration * fi->sample_rate) /(h->clock_rate * fraction); >>+ fi->duration = (double)fi->sample_count / fi->sample_rate; >Please no double type. >Also make use of av_rescale. Around line 1108 of the avcodec patch, I found the duration was not needed and removed it. On 6/13/23 12:04 PM, Anton Khirnov wrote: > Also do note that sharing structs across libraries opens you to various > compatibility questions [2]. It might be easier to sidestep them by > having a function in libavcodec that accepts AVCodecParameters and fills > them according to the data, rather than pass codec-specific structs > between libavformat and libavcodec. In line 1061 of the avcodec patch, changed the function to: int av_dtsuhd_frame(DTSUHD *h, const uint8_t *data, size_t data_bytes, AVCodecParameters *codecpar, uint8_t **udts, int *udts_size) Thank you for reviewing this, -Roy