~ubuntu-branches/ubuntu/precise/crtmpserver/precise-backports

« back to all changes in this revision

Viewing changes to thelib/src/streaming/streamcapabilities.cpp

  • Committer: Package Import Robot
  • Author(s): Micah Gersten
  • Date: 2012-07-04 00:04:40 UTC
  • mfrom: (3.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20120704000440-u9x7yhyglqjvspk8
Tags: 1.0~dfsg-3~ubuntu12.04.1
No-change backport to precise (LP: #964153)

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
        Clear();
36
36
}
37
37
 
38
 
//#define DUMP_VAL(name,type,length) if(length!=0) FINEST("% 8s %50 s: % 4.0f; l: % 2u; ba: % 4u",#type,name,(double)v[name],length,ba.AvailableBits()); else WARN("% 8s %50 s: % 4.0f; l: % 2u; ba: % 4u",#type,name,(double)v[name],length,ba.AvailableBits());
 
38
//#define DUMP_VAL(name,type,length) if(length!=0) FINEST("%8s %50s: %4.0f; l: %2u; ba: %4u",#type,name,(double)v[name],length,ba.AvailableBits()); else WARN("%8s %50s: %4.0f; l: %2u; ba: %4u",#type,name,(double)v[name],length,ba.AvailableBits());
39
39
#define DUMP_VAL(name,type,length)
40
40
 
41
41
#define CHECK_BA_LIMITS(name,length) \
348
348
        _rate = 90000;
349
349
 
350
350
        BitArray spsBa;
351
 
        spsBa.ReadFromBuffer(_pSPS + 1, _spsLength - 1);
 
351
        //remove emulation_prevention_three_byte
 
352
        for (uint16_t i = 1; i < _spsLength; i++) {
 
353
                if (((i + 2)<(_spsLength - 1))
 
354
                                && (_pSPS[i + 0] == 0)
 
355
                                && (_pSPS[i + 1] == 0)
 
356
                                && (_pSPS[i + 2] == 3)) {
 
357
                        spsBa.ReadFromRepeat(0, 2);
 
358
                        i += 2;
 
359
                } else {
 
360
                        spsBa.ReadFromRepeat(_pSPS[i], 1);
 
361
                }
 
362
        }
352
363
 
353
364
        if (!ReadSPS(spsBa, _SPSInfo)) {
354
365
                WARN("Unable to parse SPS");
362
373
        }
363
374
 
364
375
        BitArray ppsBa;
365
 
        ppsBa.ReadFromBuffer(_pPPS + 1, _ppsLength - 1);
 
376
        //remove emulation_prevention_three_byte
 
377
        for (uint16_t i = 1; i < _ppsLength; i++) {
 
378
                if (((i + 2)<(_ppsLength - 1))
 
379
                                && (_pPPS[i + 0] == 0)
 
380
                                && (_pPPS[i + 1] == 0)
 
381
                                && (_pPPS[i + 2] == 3)) {
 
382
                        ppsBa.ReadFromRepeat(0, 2);
 
383
                        i += 2;
 
384
                } else {
 
385
                        ppsBa.ReadFromRepeat(_pPPS[i], 1);
 
386
                }
 
387
        }
 
388
        
366
389
        if (!ReadPPS(ppsBa, _PPSInfo)) {
367
390
                WARN("Unable to read PPS info");
368
391
        }