[FFmpeg-soc] [PATCH] xiph packetizer

Martin Storsjö martin at martin.st
Tue Jul 27 12:03:58 CEST 2010


On Mon, 26 Jul 2010, Josh Allmann wrote:

> This version works better, but is not yet complete.
> 
> -The scaffolding for Vorbis is mostly up, but I have to set its SDP properly.
> -Theora video has problems with I-frames (or whatever the Theora
> equivalent is), and exhibits serious blocking in areas of motion. I
> hope this is due to some invalid reads that Valgrind complains about.
> -Packing multiple frames in a single packet is another TODO.

A few comments:


+void ff_rtp_send_xiph(AVFormatContext *s1, const uint8_t *buff, int size)
+{
+    RTPMuxContext *s = s1->priv_data;
+    int max_pkt_size, xdt, frag;
+    uint8_t *q;
+
+    max_pkt_size = s->max_payload_size;
+
+    /* set xiph data type */
+    switch (*buff) {
+        case 0x01:   // vorbis id
+        case 0x05:   // vorbis setup
+        case 0x80:   // theora header
+        case 0x82:   // theora tables
+            xdt = 1; // packed config payload
+        case 0x03:   // vorbis comments
+        case 0x81:   // theora comments
+            xdt = 2; // comment payload
+        default:
+            xdt = 0; // raw data payload
+    }

I guess you want break statements in the switch, too...

+    /* set ident
+     * Probably need a non-fixed way of generating
+     * this, but it has to be done in SDP and passed in from there. */
+    q = s->buf;
+    *q++ = 0xfe;
+    *q++ = 0xcd;
+    *q++ = 0xba;

I haven't read the specs, but what's the role of this ident code? Is there 
any harm in having it hardcoded to a specific value? Is it set in the 
original stream data somewhere, so that you'd have to parse out the 
correct value from there? Or is it only used to distinguish streams if you 
have more than one vorbis/theora stream in the same presentation? In that 
case, you could use e.g. one hardcoded value for vorbis and another for 
theora - that would probably be enough for some time at lesat.

// Martin


More information about the FFmpeg-soc mailing list