rust-ffmpeg icon indicating copy to clipboard operation
rust-ffmpeg copied to clipboard

Fix incorrect sizes for plane and data slices for audio frames.

Open tage64 opened this issue 3 years ago • 1 comments

This pull request fixes two bugs:

  • The size of a plane created by frame::Audio::plane() for a packed audio frame with more than one channel was incorrectly set to the number of samples. It is now changed to be the number of samples times the number of channels.
  • The size of the slice created by frame::Audio::data(n) for n > 0 was incorrectly set to 0. It is now changed to be the same as for n=0.

Some explanations can be found at the doxygen documentation for AVFrame. In particular:

◆ linesize

int AVFrame::linesize[AV_NUM_DATA_POINTERS] ... For audio, only linesize[0] may be set. For planar audio, each channel plane must be the same size.

tage64 avatar Jun 14 '22 09:06 tage64

I just tested myself and can confirm that plane() is now working as intended.

sagudev avatar Aug 10 '22 06:08 sagudev