Show
Ignore:
Timestamp:
01/23/15 18:15:20 (4 days ago)
Author:
robert
Message:

From Javier Taibo,
"I have found a "bug" in the new audio decoding code (actually I think the bug is in ffmpeg, but anyway it should be wise to protect the OSG plug-in about it). I am attaching a security check in FFmpegDecoderAudio.cpp.

If anybody is curious about the problem, it happens sometimes when decoding an AAC audio stream. It eventually includes a PCE block inside the AAC audio frame and then ffmpeg audio decoding function signals a "new_frame" with 1024 samples, but a null pointer instead of the audio data. It can be easily detected because in these cases number of channels is 0. Maybe this is the intended behaviour for ffmpeg, but I find it quite weird.
"

" It seems that libav does not have a channels attribute in AVFrame structure. This new version should do."

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgimpostor/osgimpostor.cpp

    r13496 r13497  
    1717*/ 
    1818 
     19#include <osg/Config> 
     20#ifndef OSG_USE_DEPRECATED_GEOMETRY_METHODS  
    1921#define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1 
     22#endif 
    2023 
    2124#include <osg/Geometry> 
     
    247250 
    248251    // load the nodes from the commandline arguments. 
    249     osg::Node* model = osgDB::readNodeFiles(arguments); 
     252    osg::ref_ptr<osg::Node> model = osgDB::readNodeFiles(arguments); 
    250253    if (model) 
    251254    { 
     
    254257        // a group then it won't be able to insert an impostor.  We therefore 
    255258        // manually insert an impostor above the model. 
    256         if (dynamic_cast<osg::Group*>(model)==0) 
     259        if (dynamic_cast<osg::Group*>(model.get())==0) 
    257260        { 
    258261            const osg::BoundingSphere& bs = model->getBound(); 
     
    263266 
    264267                // standard LOD settings 
    265                 impostor->addChild(model); 
     268                impostor->addChild(model.get()); 
    266269                impostor->setRange(0,0.0f,1e7f); 
    267270                impostor->setCenter(bs.center()); 
     
    282285        // on it right now as it requires a getRoots() method to be added to 
    283286        // osg::Node, and we're about to make a release so no new features!  
    284         osg::Group* rootnode = new osg::Group; 
    285         rootnode->addChild(model); 
     287        osg::ref_ptr<osg::Group> rootnode = new osg::Group; 
     288        rootnode->addChild(model.get()); 
    286289 
    287290 
     
    307310 
    308311    // add model to viewer. 
    309     viewer.setSceneData(model); 
     312    viewer.setSceneData(model.get()); 
    310313 
    311314    return viewer.run();