From 402424f0148b07d33b1458314098dff4ed6388d1 Mon Sep 17 00:00:00 2001 From: mpromonet Date: Sun, 19 Jun 2016 08:53:56 +0000 Subject: [PATCH] add log in JPEG source --- inc/MJPEGVideoSource.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/inc/MJPEGVideoSource.h b/inc/MJPEGVideoSource.h index 82a9888..250daf5 100644 --- a/inc/MJPEGVideoSource.h +++ b/inc/MJPEGVideoSource.h @@ -10,6 +10,7 @@ ** ** -------------------------------------------------------------------------*/ +#include "logger.h" #include "JPEGVideoSource.hh" class MJPEGVideoSource : public JPEGVideoSource @@ -49,6 +50,8 @@ class MJPEGVideoSource : public JPEGVideoSource m_height = (fTo[i+5]<<5)|(fTo[i+6]>>3); m_width = (fTo[i+7]<<5)|(fTo[i+8]>>3); m_type = (fTo[i+11] - 0x21); + LOG(INFO) << "width:" << (int)m_width << " height:" << (int)m_height << " type:"<< (int)m_type; + } // DQT if ( (i+5+64) < frameSize && (fTo[i] == 0xFF) && (fTo[i+1] == 0xDB)) @@ -59,7 +62,10 @@ class MJPEGVideoSource : public JPEGVideoSource { memcpy(m_qTable + quantSize*quantIdx, fTo + i + 5, quantSize); if (quantSize*quantIdx+quantSize > m_qTableSize) + { m_qTableSize = quantSize*quantIdx+quantSize; + LOG(NOTICE) << "Quantization table idx:" << quantIdx << " size:" << quantSize << " total size:" << m_qTableSize; + } } } // End of header @@ -76,6 +82,10 @@ class MJPEGVideoSource : public JPEGVideoSource fFrameSize = frameSize - headerSize; memmove( fTo, fTo + headerSize, fFrameSize ); } + else + { + LOG(NOTICE) << "Bad header => dropping frame"; + } fNumTruncatedBytes = numTruncatedBytes; fPresentationTime = presentationTime;