check stream index validity in av_program_add_stream_index