Sunday 26 October 2014

Week 7

This past week was the busiest school week yet. Midterms really threw a wrench in my usual plans for managing the workload. I also happen to have assignments due on the first three days of the coming week, so I have spent all of the weekend at home doing work. That said, my schedule looks like it's clearing up a little after Wednesday, so I may actually get to spend next weekend doing something other than schoolwork!


What I Worked On

Earlier in the week I met with mtomwing over IRC and got some excellent feedback on the Configuration API draft that I started writing a couple of weeks ago. I reworked most of the Configuration endpoints based on his feedback. These can be seen here:


Later in the week, I spent some time debugging an issue with the refactored plugins code where different instances of a plugin were being saved under the same section in the plugin.conf file. I fixed that issue, made a few other suggested changes and improvements, and the plugins refactoring PR was merged into master! 

While testing the plugins code I also discovered a quirk with the plugin settings widgets: hitting 'close' on a settings window does not save the configuration, so for some of the plugins the default settings shown in their config widgets don't match the settings actually written to file until the user actively changes them. I opened an issue with a more detailed description:


What I Will be Working On

This week I want to prioritize work on the Configuration API, as I think there will probably be many details to work out once I start delving into implementation.

I would also like to have another look at https://github.com/Freeseer/freeseer/issues/636 to see if it's possible to improve the plugin widgets by adding config.save() callback methods to their close buttons.

Saturday 18 October 2014

Week 6

This felt like a very short week: probably because we had our last meeting on tuesday due to Thanksgiving weekend travel plans. It also happened to be a very busy week for me in terms of assignments, so I can't say I got as much done for Freeseer as I would have liked.


What I Worked On


Plugins

I made some changes to the plugin refactoring PR after receiving some feedback:


Configuration API Spec

I made a few changes to several endpoints in the spec. The biggest change being that I completely separated the endpoints for viewing/setting the configuration profile from the endpoints that cover the configuration itself.

The spec draft can be viewed here:


Flask and Configuration

I spent some time reading about flask (http://flask.pocoo.org/), and going over the existing recording.py and server.py code. I started experimenting on the configuration controller implementation, and opened a WIP pull request to keep track of these experiments: https://github.com/Freeseer/freeseer/pull/632

Issues

I encountered a unit test failure while testing some of my plugin configuration changes. Strangely enough, it was related to the server tests using the user's real configuration dir and not at all related to the plugins. I opened an issue for it: https://github.com/Freeseer/freeseer/issues/629


What I Will Be Working On

I will mostly be working on the configuration.py controller and some of the related functionality. 

An enhancement I would like to see for the Config classes is to have a method that returns the Config's options wrapped as key-value pairs in a dictionary. ChoiceOption classes could be represented as a list of available options plus its selected one. This will make the implementation of the configuration endpoints much cleaner and straight-forward. I may tackle this over the next week, since it makes sense to have this enhancement before going too deep into implementing the configuration back end.

Next week also happens to be particularly busy again due to midterms and a nasty assignment due date, so I may not get much time to work on Freeseer until later in the week: probably friday and saturday. However, I will check for and respond to any feedback I get on the config API spec.

Monday 13 October 2014

Week 5

The past weekend was Thanksgiving, and involved a bit of travelling and family time. Most of the work I did on Freeseer was from earlier in the week, although I managed to sneak in a bit of homework between bouts of Turkey meals.

What I Worked On

Plugins

I spent the earlier part of the week working Plugin refactoring. The first task I spent time on was writing up a brief description of the unsupported plugin problem I had found while refactoring the firewire plugin last week, which can see read all about in this document: https://docs.google.com/document/d/16tRySYdZIaKww8L32wWFMSMX67ifXy77VjNh3zSBWd8/edit

Given feedback from one of Freeseer's mentors, I re-visited all of the plugins that were potentially affected by the above issue and simplied their Config classes to use StringOptions instead of ChoiceOptions. 

I also spent some time converting the last plugins that were still using the old Plugin Manager configurations to use Config classes instead: Pip, VideoPassthrough, Audiofeedback, Ogg Icecast, Ogg output, Videopreview, RTMP Streaming.

Configuration API Spec

I did some review of RESTful API design and started on a draft for the Freeseer Configuration API Spec, documented here: 

So far this spec includes endpoints for user profile, the general config page, the recording config page,  accessing plugin categories (audio, video, file, streaming) and specific plugins. I have not yet considered endpoints for the other two pages in the configuration tool.

Issues

I had an interesting issue with the Travis-CI unit tests earlier in the week. Basically, the multimedia unit tests were failing on Travis despite not failing when I ran them locally. To complicate matters, the failure on Travis was silent: There was no unit test output of any sort, and no messages specifying which particular test was failing. The test script just exited abruptly at the test_multimedia.py file.

The actual cause for the unit test failure was related to one of the plugins having a default value that was incompatible with the VM that Travis was running the tests on: The VideoPassthrough Plugin's default input was set to 'Desktop Source', which is unfortunately not supported on Travis. Changing this to 'Video Test Source' fixed the issue.

More importantly, we never did quite figure out why the unit tests were failing silently. If this happens to someone else in the future, one way of ensuring more output is to modify the ./run_tests script in the root folder of Freeseer by making this change as suggested by mtomwing:

-run_or_fail "src" "python setup.py test"
+run_or_fail "src" "py.test --verbose"


What I Will Be Working On

The coming week I plan on continuing work on both the plugin refactoring and the configuration API spec, and hope to get feedback on both. If the API spec looks reasonably good and I have extra time, then I will also start on writing the Configuration Controller class.

Sunday 5 October 2014

Week 4

What I Worked On

All of the work I did this week once again focused on refactoring existing plugin classes to work with the freeseer framework's Config class, and can be seen here (https://github.com/Freeseer/freeseer/pull/589). The overview of items I worked on is as follows:
  • Finished with the audiomixer package by refactoring the MultiAudio plugin.
  • Refactored all of the videoinput plugins: DesktopLinuxSrc, FirewireSrc, UsbSrc, and VideoTestSrc.
  • Made the new ChoiceOptionFunction class a bit more robust in handling cases where the choice function returns no options.
  • Spent quite a bit of time debugging an issue related to plugins not finding any compatible devices (described below) and the Config class' strong objections to such cases.

Issues 

In Freeseer's master branch, plugin configurations are persisted to file (plugin.conf) when the user makes any changes to the plugin's settings from inside the configuration windows, or when the user simply opens that plugin's configuration widget even if no changes are made. I wanted to fully duplicate this behavior in my branch with the new Config classes, but ran into an interesting issue while working on the firewire plugin. 

My laptop has no firewire, so naturally initializing the firewire plugin produces no selectable options for video. While the master branch handles this particular case by creating a default but fictional "/dev/fw1" entry to save in the plugin.conf file, the Config files I am working with in my branch are much stricter. Saving the plugin settings to file with a missing configuration option throws an OptionValueNotSetError. Saving to file with a fictional default value (like on master branch) throws an InvalidOptionValueError.

This same issue is causing some failures on the Travis CI tests, as some of the other plugins (PulseAudioSrc and UsbSrc) that are now using the Config files are also not detecting any compatible devices available on the Travis test VM. Since no compatible device is available, the Config file can't have a real value for that particular configuration option, and so throws the OptionValueNotSetError when the plugin's initialization code tries to read the device.

What I'll be Working On

I'll first revisit the issue I described above: I was considering extending the Options code to have an Options.NoneAvailable type as well as the existing Options.NotSpecified. This will let us explicitly record the fact that there are no compatible devices detected for a configuration. 

I'll need to review the plugins' init methods and make sure they can handle the cases where some needed option ends up being NoneAvailable. It's possible we should also alert the user when some chosen plugin finds no compatible devices, since the current code doesn't do that.

I still need to refactor the PIP (picture-in-picture), and the VideoPassthrough video plugins.

Finally, I need to start writing up a spec for the configuration system's REST api, although this task may get pushed back a week since I'm still dealing with the above plugin issues this week.