Me again; I'm working on AO 1.9.3 and to get NextGen Gallery's JS to aggregate, I would need to change not only the priority but also the action hook.
add_action('template_redirect','autoptimize_start_buffering',2);
would become
add_action('init','autoptimize_start_buffering',-1);
As the priority is higher (well, lower number means higher priority) and as it hooks to an earlier action, I would expect this not to cause problems, but it would be great if you could test this.
frank