[Live-devel] rfc 2435 JPEG with one quantization table

Евгений Шубин shubin_evgeniy at mail.ru
Sun Aug 16 03:59:21 PDT 2009


I write a stream server according to rfc 2435 using liveMedia library. 
I created a class inherited from JPEGVideoSource. It works fine with JPEGs with two quantization tables.
When I try to stream JPEG with one quantization table, recieved JPEGs are broken.
They have a reference to quantization table with Id = 1.
I looked to the source code of JPEGVideoRTPSource:
line 224
  // MARKER_SOF0:
  *ptr++ = 0xFF; *ptr++ = MARKER_SOF0;
  *ptr++ = 0x00; *ptr++ = 0x11; // size of chunk
  *ptr++ = 0x08; // sample precision
  *ptr++ = (BYTE)(h >> 8);
  *ptr++ = (BYTE)(h); // number of lines (must be a multiple of 8)
  *ptr++ = (BYTE)(w >> 8);
  *ptr++ = (BYTE)(w); // number of columns (must be a multiple of 8)
  *ptr++ = 0x03; // number of components
  *ptr++ = 0x01; // id of component
  *ptr++ = type ? 0x22 : 0x21; // sampling ratio (h,v)
  *ptr++ = 0x00; // quant table id
  *ptr++ = 0x02; // id of component
  *ptr++ = 0x11; // sampling ratio (h,v)
  *ptr++ = numQtables == 1 ? 0x00 : 0x01; // quant table id
  *ptr++ = 0x03; // id of component
  *ptr++ = 0x11; // sampling ratio (h,v)
  *ptr++ = 0x01; // quant table id 

In the last line quant table id is set to one in any case.
Is it a bug, or what I do wrong?
May be I use to set type to value other than 0 or 1?

Thanks.



More information about the live-devel mailing list