Ticket #1637: adaptive_audio_only.patch

File adaptive_audio_only.patch, 3.7 KB (added by jeroen, 13 months ago)
  • src/com/longtailvideo/adaptive/muxing/AAC.as

    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
     
    1515        public static const SYNCWORD_2:uint =  0xFFF9; 
    1616        /** ADTS/ADIF sample rates index. **/ 
    1717        public static const RATES:Array =  
    18             [96000,88200,64000,48000,44100,32000,24000,22050,16000,12000,11025]; 
     18            [96000,88200,64000,48000,44100,32000,24000,22050,16000,12000,11025,8000]; 
    1919        /** ADIF profile index (ADTS doesn't have Null). **/ 
    2020        public static const PROFILES:Array = ['Null','Main','LC','SSR','LTP','SBR']; 
    2121 
  • src/com/longtailvideo/adaptive/muxing/TS.as

     
    4444            while(data.bytesAvailable) { 
    4545                _readPacket(data); 
    4646            } 
    47             if (_videoPES.length == 0 || _audioPES.length == 0 ) { 
    48                 throw new Error("No AAC audio or AVC video stream found."); 
     47            if (_videoPES.length == 0 && _audioPES.length == 0 ) { 
     48                throw new Error("No AAC audio and no AVC video stream found."); 
    4949            } 
    5050            // Extract the ADTS or MPEG audio frames. 
    5151            if(_aacId > 0) { 
     
    7171        /** Get video configuration data. **/ 
    7272        public function getAVCC():ByteArray { 
    7373            if(_firstKey == -1) { 
    74                 throw new Error("Cannot parse stream: no keyframe found in TS fragment."); 
     74                return new ByteArray(); 
    7575            } 
    7676            return AVC.getAVCC(_videoPES[_firstKey].data,_videoPES[_firstKey].payload); 
    7777        }; 
  • src/com/longtailvideo/adaptive/streaming/Loader.as

     
    124124            } 
    125125            // Push codecprivate tags only when switching. 
    126126            if(_switched) { 
    127                 var avccTag:Tag = new Tag(Tag.AVC_HEADER,ts.videoTags[0].stamp,true,_level,_fragment); 
    128                 avccTag.push(_levels[_level].avcc,0,_levels[_level].avcc.length); 
    129                 tags.push(avccTag); 
     127                if (ts.videoTags.length > 0) { 
     128                        // Audio only file don't have videoTags[0] 
     129                        var avccTag:Tag = new Tag(Tag.AVC_HEADER,ts.videoTags[0].stamp,true,_level,_fragment); 
     130                        avccTag.push(_levels[_level].avcc,0,_levels[_level].avcc.length); 
     131                        tags.push(avccTag); 
     132                } 
    130133                if(ts.audioTags[0].type == Tag.AAC_RAW) { 
    131134                    var adifTag:Tag = new Tag(Tag.AAC_HEADER,ts.audioTags[0].stamp,true,_level,_fragment); 
    132135                    adifTag.push(_levels[_level].adif,0,2) 
     
    159162                } 
    160163            } 
    161164            if(level == -1) { 
    162                 _adaptive.dispatchEvent(new AdaptiveEvent(AdaptiveEvent.ERROR, 
    163                     "None of the quality levels in this stream can be played.")); 
     165                Log.txt("No other quality levels are available"); 
     166                return; 
    164167            } 
    165168            // Then update with highest possible level. 
    166169            for(var j:Number = _levels.length - 1; j > 0; j--) {