Added check against a minimual video size of 10x10 to prevent problems with swscale reporting errors and crashing on small video dimensionsline, and those below, will be ignored--

M    ffmpeg/FFmpegImageStream.cpp
This commit is contained in:
Robert Osfield
2009-08-20 14:59:00 +00:00
parent c6fe8046dc
commit fe8822e496

View File

@@ -72,15 +72,23 @@ bool FFmpegImageStream::open(const std::string & filename)
const_cast<unsigned char *>(m_decoder->video_decoder().image()), NO_DELETE
);
setPixelAspectRatio(m_decoder->video_decoder().pixelAspectRatio());
osg::notify(osg::NOTICE)<<"ffmpeg::open("<<filename<<") size("<<s()<<", "<<t()<<") aspect ratio "<<m_decoder->video_decoder().pixelAspectRatio()<<std::endl;
#if 1
// swscale is reported errors and then crashing when rescaling video of size less than 10 by 10.
if (s()<=10 || t()<=10) return false;
#endif
m_decoder->video_decoder().setUserData(this);
m_decoder->video_decoder().setPublishCallback(publishNewFrame);
if (m_decoder->audio_decoder().validContext())
{
osg::notify(osg::NOTICE)<<"Attaching FFmpegAudioStream"<<std::endl;
getAudioStreams().push_back(new FFmpegAudioStream(m_decoder.get()));
}