Review | GSoC 2019

I've been working on GStreamer based project of Gnome Foundation. GStreamer is a pipeline-based multimedia framework that links together a wide variety of media processing systems to complete complex workflows. The framework is based on plugins that will provide various codec and other functionality. The plugins can be linked and arranged in a pipeline. And most of the plugins are written in C. Now the developers are in an attempt to convert them to Rust which is more robust and easily maintainable. My task is to be a part of this conversion and to help fix issues related to this.

Planned Tasks

  1. Implement Hyper-based HTTP source around async IO and make it feature-complete. (Explained in below section)
    GitLab issue: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/issues/31
  2. Tutorial for gst-plugin-tutorial crate. (Explained in below section)
    GitLab issue: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/issues/44
  3. Finish FLV demuxer. Conversion of FLV demuxer to Rust is not fully complete. My task is to complete the FLV demuxer with the feature equivalent to FLV demuxer in C.
    GitLab issue: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/issues/16

Completed Tasks

we changed the plans from the initial plan due to the tasks taking more time than expected. During the planning phase we didn’t get the whole idea about the task. On the run we figured that the tasks are bigger than expected.

1
Implement Hyper-based HTTP source around async IO and make it feature-complete.
Done partially
2
Tutorial for gst-plugin-tutorial crate which has 4 features.
(Rgb2gray, Sinesrc, identity, Progressbin)
Done partially 
(Completed Rgb2gray, Sinesrc)
3
Finish FLV demuxer
Did not do
4
Extra: Add build.rs
Done fully

Breakdown of the completed tasks

Task 1

Adding build.rs that provides a version number, release date and other meta data to the GStreamer plugin. The idea of this is to automatically infer useful values for the plugin during the build instead of hard coding them. I have used git2 crate for this purpose.Issue: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/issues/5
Merge request: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/merge_requests/91

Task 2

Moving the tutorials to markdown. Sebastian Dröge has written a series of blog posts on GStreamer plugin development in Rust. My task is to convert it to markdown and put it in the gst-plugin-tutorial crate on which the tutorial is based. Let me explain to you about gst-plugin-tutorial crate. This crate has a plugin with 4 features (Rgb2gray, Sinesrc, Identity and Progressbin). But I have completed below features only
  1. Rgb2gray
  2. Sinesrc
There are blog posts for rgb2gray and sinesrc. Also the code snippets there have to be updated along with some explanations. I had to update the code snippets to match the latest version of the gst-plugin-tutorial crate. And then I had to match the description to the updated code snippets. This task made me understand how a Gstreamer plugins work and how to develop them in Rust. Also I was able to familiarize with Rust which is a new language to me.
Issue: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/issues/44
Merge request: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/merge_requests/99

Task 3

Making Rust HTTP source plugin asynchronous. I have made this plugin requests and receiving asynchronous and cancellable. Reqwesthttpsrc is the Rust HTTP source is a plugin which reads data from a remote location specified by a URI and the supported protocols are HTTP and HTTPS. souphttpsrc is the C version of the HTTP source plugin.
Issue: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/issues/31
Merge request: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/merge_requests/127

Task 4

Writing Test for Rust HTTP source Reqwesthttpsrc. Although the plugin code was partially built, the test was not written to any of the features. My mentor, Sebastian Dröge helped me for the first test and the needed class. Then we came up with few test cases and wrote the tests for them.


Test Case
Merge request/Commit
1
Behavior when HTTP server not found (404) error returns to the Plugin. 
2
Seeking to a position after the element reached READY state
3
Seeking after a buffer was received already

And more importantly, I found a few bugs in the plugin while writing the test and corrected them. They are


  1. HTTP error response were not handled correctly before. I was able to find that error and correct it. 

Task 5

Rust HTTP source was not feature complete. It had only few features of souphttpsrc which is the C version of HTTP source. One of my goals was to implement the missing properties in reqwesthttpsrc. Below are the properties I have implemented.



Name of the properties
Description
Merge request
1
is-live
This is a property which can have Boolean value. If it's set to true then the plugin act as a live source. Live sources are sources that when paused discard data, such as audio or video capture devices.
2
timeout
Setting timeout to the request. By default it has a timeout of 15 seconds.
3
user-agent
User-Agent is an HTTP request header field. This header is used to identify where the request is being originated from. The User-Agent HTTP request header is set to a custom string using this property. Default value for user-agent header is "GStreamer reqwesthttpsrc".
4
user-id
HTTP location URI user id and password for authentication. 
5
user-pw
6
automatic-redirect
Still not completed (2019.08.20)
When the status code is 3xx, follow the redirect link.

There are few more properties and features such as context sharing to be implemented in Rust HTTP source in order to feature complete the plugin. Missing properties are
  1. compress
  2. cookies
  3. extra-headers
  4. iradio-mode
  5. keep-alive
  6. method
  7. proxy
  8. proxy-id
  9. proxy-pw
  10. retries
  11. ssl-ca-file
  12. ssl-strict
  13. ssl-use-system-ca-file
Once these properties and context sharing feature is complete, reqwesthttpsrc (Rust version) can be used instead of souphttpsrc (C version).

Comments

Popular posts from this blog

The Journey Begins | Google Summer of Code

I was there at GNOME.Asia Summit 2019