[haiku-commits] haiku: hrev50830 - src/add-ons/media/plugins/ffmpeg

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 6 Jan 2017 22:52:18 +0100 (CET)

hrev50830 adds 1 changeset to branch 'master'
old head: 1d8306654a786a74cd83bc96db97e2b433ee86b2
new head: 5d56964421130db129c4820383ab325fc61e5f8b
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=5d5696442113+%5E1d8306654a78

----------------------------------------------------------------------------

5d5696442113: AVFormatReader: take the frame size into account
  
  In ffmpeg, an audio frame may be made of multiple samples. We don't
  really support that in our plug-in, and assume the frame rate and sample
  rate are the same thing.
  
  Adjust the reported frame count by multiplying ffmpeg's frame count by
  its frame size (which is the number of samples per frame).
  
  This fixes audio not working or stopping after a short time in
  MediaPlayer, which uses the frame count this way.

                             [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev50830
Commit:      5d56964421130db129c4820383ab325fc61e5f8b
URL:         http://cgit.haiku-os.org/haiku/commit/?id=5d5696442113
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Fri Jan  6 21:48:27 2017 UTC

----------------------------------------------------------------------------

1 file changed, 1 insertion(+), 1 deletion(-)
src/add-ons/media/plugins/ffmpeg/AVFormatReader.cpp | 2 +-

----------------------------------------------------------------------------

diff --git a/src/add-ons/media/plugins/ffmpeg/AVFormatReader.cpp 
b/src/add-ons/media/plugins/ffmpeg/AVFormatReader.cpp
index 5be7306..ab3518a 100644
--- a/src/add-ons/media/plugins/ffmpeg/AVFormatReader.cpp
+++ b/src/add-ons/media/plugins/ffmpeg/AVFormatReader.cpp
@@ -1254,7 +1254,7 @@ AVFormatReader::Stream::GetStreamInfo(int64* frameCount,
        }
        #endif
 
-       *frameCount = fStream->nb_frames;
+       *frameCount = fStream->nb_frames * fStream->codec->frame_size;
        if (*frameCount == 0) {
                // Calculate from duration and frame rate
                *frameCount = (int64)(*duration * frameRate / 1000000LL);


Other related posts: