rename rtmp_stack to stack. remove the global templte function to member function.