07.17.08
Posted in gsoc at 3:53 am by martinhrvn
Few days ago I have sucessfully tested the GSM/RTP in Sip Communicator using the testing Asterisk numbers. It works!
So now we have decided to continue with the next item on our to-do list for FMJ which is JPEG/RTP. I have been reading the RFC2435 that is the specification for JPEG/RTP. JPEG/RTP currently works but it’s not working right (as it is specified in RFC2435) now it sends JPEG images including various headers/tables etc. What it really should do is send RTP header then add JPEG/RTP header which contains some information regarding the image (Q, width, height and type) and then the JPEG data (without any additional headers). If quantization tables are to be specified then the Q should be set to interval of 128-255 and the tables should be packed immediately after the JPEG header.
Since I haven’t been able to find if it is possible to write just the data and strip the headers I have created JPEG parser that is able to strip most of the important headers (SOI marker, JFIF marker, Quantization and Huffman tables marker, Start of frame/scan marker, EOI marker..)
There is sample code (in C of course
) present in the RFC of how to build packets correctly. There are however few things that are still not clear. For instance where should we specify the parameters (such as Q, or custom quantization tables, type and typeSpecific fields). For I believe it would be OK to hardcode values for them (and use only them) as there should be no problem with it and ensure we can decode incoming packets correctly.
Permalink
07.11.08
Posted in gsoc at 12:30 pm by martinhrvn
Finally after quite a long time the GSM/RTP works. Yesterday I have been able to sucessfully test it and I already commited to FMJ’s CVS. The quality of encoding is low and will be until the bug is discovered in my GSM Encoder library. I am working on it.
This somewhat finalizes part of my work, the next thing to do is to register GSM/RTP within Sip Communicator so it would accept and generate SDP for GSM/RTP correctly. After having that working, according to my communication with Ken, the next place that needs some attention in FMJ is JPEG/RTP. It works already but Ken said it is only packetized by splitting into pieces which is not what it should do according to JPEG/RTP specifications.
It certainly seems like very interesting thing to work on and I am looking forward to learning new things, just like I did now with a) fitting existing decoder into FMJ b) translating from C to Java c) making it all work (creating parser, multiplexer, packetizer etc.). I feel like I really learned a lot already and most of all it has been fun (with exception of few moments when debuging the GSM Encoder
).
Permalink
07.08.08
Posted in Uncategorized at 12:00 pm by martinhrvn
Time has come for mid-term evaluation so in this post I will try to sum up what I have been doing with my project.
During the last week I have managed to improve the GSM Encoder in terms of functionality and code “beauty”. I have been also integrating it into FMJ so that it would be available for usage once JMF is replaced with FMJ (Ken sent me patch and I have tested it and it works..)
Yesterday I got write permission to FMJ’s repository so I commited first batch of files. I am still working on the GSM/RTP support. There were some changes in RTPSessionMgr that cause NullPointerException and in the original code runs out of array. I am trying to find out what is happening.
What works: FMJ is now able to play, transcode and record GSM files, with a bit of luck the RTP transmission will work soon
What’s left to do: Make the RTP work and integrate it into Sip Communicator.
Permalink
06.07.08
Posted in gsoc at 3:29 am by martinhrvn
Summer of code is on. In fact it has been on for some time so I decided to update this blog with what’s been keeping me busy. First of all Ken showed me how to replace JMF with FMJ. I thought it would be more troubles. Next he suggested I should implement a GSM decoder. This was relatively easy because there was the GSM decoder for Java so all was left to do was to use it to play .gsm files.The FMJ can now play .gsm files, but to be able to use GSM codec for RTP there has to be an encoder too. That is a trickier thing to do - there is no Java encoder so I’ll have to port GSM encoder from C to Java.
At first this seemed like nothing too hard, but because of the nature of the original sourcecode it’s not that easy. First obstacle are the macros, macros are used extensively through the code so the best solution was to run the code through preprocessor and then use the preprocessed code, this worked fine, but at some places the macros contained loops that the preprocessor expanded and the code became somewhat unreadable.
Secondly the types, Java has no unsigned types. This should not matter with int or long, but it could be a problem with byte, it is possible to get unsigned value of byte but it’s not byte type anymore. Fortunately this was not a big problem with this encoder.
Another bigger problem are pointers, not only that the primitive types are passed by value in Java (this can be solved by creating an array of int and pass that to a method), but it’s also possible to increment them (and I didn’t mention it’s perfectly ok to do ptr[-1] with pointers in C). As solution there were created offset variables, which represent the pointer offset.
Current state of the encoder port:
works: throws no errors or exceptions so technically works, sample PCM to GSM converter
doesn’t work: encoded files sound terribly (probably some sort of bug), code needs to be “beautified”.. (plus everything I forgot)
what’s to do: finish the encoder, create packetizers and depacketizers, parser and make it work with RTP
Permalink
04.27.08
Posted in gsoc at 6:04 am by martinhrvn
This is my introductory post. I would have written it much earlier, but I am very busy with school recently because I would like to finish early so that I can work on GSoC project. Oh, while I’m at it, aim of my project is to replace JMF (Java Media Framework) with FMJ (Freedom for Media in Java, open source JMF alternative - newer and active). It seems like a good thing to do. JMF development is not active anymore.
It all began couple of days before the official announcement when Emil Ivov contacted me that two organizations are ready to give me one of their slots (Sip Communicator and ArgoUML). I have decided to chose Sip Communicator, because it seems somewhat more challenging and I think that I will learn a lot by working on it.
I knew the fact that Emil contacted me was a good sign, but I waited impatiently until April 21st until it was official, and well I got accepted! Then my mentor - founder of FMJ - Ken Larson contacted me by e-mail and we chatted over IM. He explained how FMJ works, what works and what would need to be done. I would have loved to do a bit more, but school had higher priority as it is almost over. Last friday besides having birthday I spend the entire day in school. And when I say entire I mean it. In the morning I went to hand in the assignment and then took written exam and waited for the oral part of it until 10.00pm! I came totally exhausted but I passed the exam
There are 2 more exams to pass before I am officially free. Both are scheduled tomorrow.
So the summary: I have set up all of the required projects - sip-communicator, fmj, ffmpeg-java, theora-java, lti-civil in both Eclipse and NetBeans. And with assistance of Ken I have been trying some things in fmj, mainly RTP. So far, so good. I can’t wait for the school to end so that I can dive into GSoC project.
Permalink