Merge "Changes to facilitate multi-threading of encoding stage"