[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haiku-commits
Subject:    [haiku-commits] Re: haiku: hrev50806 - in src: kits/media add-ons/media/plugins/ffmpeg
From:       Stephan_Aßmus <superstippi () gmx ! de>
Date:       2016-12-30 21:18:52
Message-ID: efb952ed-16d1-009e-550f-a81f5c55af62 () gmx ! de
[Download RAW message or body]

Am 30.12.2016 um 17:34 schrieb pulkomandy@pulkomandy.tk:
> ffmpeg: use stream frame count, if provided.
> 
> Not sure why that was commented out. Computing the frame count back from
> the frame duration and stream duration can be inaccurate (especially for
> long frame durations and/or short streams). It is important that the
> stream ends exactly when expected. If it ends earlier than the announced
> frame count, an app may be stuck forever waiting for the end, or would
> interpret it as a read error. If it is too long, a buffer overflow may
> occur.
> 
> ----------------------------------------------------------------------------
> 
> diff --git a/src/add-ons/media/plugins/ffmpeg/AVFormatReader.cpp \
> b/src/add-ons/media/plugins/ffmpeg/AVFormatReader.cpp index b28ead0..796770d 100644
> --- a/src/add-ons/media/plugins/ffmpeg/AVFormatReader.cpp
> +++ b/src/add-ons/media/plugins/ffmpeg/AVFormatReader.cpp
> @@ -29,7 +29,7 @@ extern "C" {
> #include "Utilities.h"
> 
> 
> -//#define TRACE_AVFORMAT_READER
> +#define TRACE_AVFORMAT_READER
> #ifdef TRACE_AVFORMAT_READER
> #	define TRACE printf
> #	define TRACE_IO(a...)
> @@ -1255,13 +1255,13 @@ AVFormatReader::Stream::GetStreamInfo(int64* frameCount,
> 	#endif
> 
> 	*frameCount = fStream->nb_frames;
> -//	if (*frameCount == 0) {
> +	if (*frameCount == 0) {
> 		// Calculate from duration and frame rate
> 		*frameCount = (int64)(*duration * frameRate / 1000000LL);
> 		TRACE("  frameCount calculated: %lld, from context: %lld\n",
> 			*frameCount, fStream->nb_frames);
> -//	} else
> -//		TRACE("  frameCount: %lld\n", *frameCount);
> +	} else
> +		TRACE("  frameCount: %lld\n", *frameCount);

I take the blame for not putting a comment there explaining why it was 
commented out. But you could of course ask here before commiting a 
change, it is after all quite likely that there was a reason it was 
commented out. If memory serves, there are streams where the frame-count 
is very unreliable. Perhaps videos with variable frame-rate. I would 
guess that overall it worked better for a greater range of files, at 
least the files I was using for testing back then.

Best regards,
-Stephan


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic