BFCP 协议

Abstract

BFCP protocol

Authors

Walter Fan

Status

v1.0

Updated

2026-03-20

Overview

BFCP 就是 Binary Floor Control Protocol 的缩写,即二进制发言权控制协议。 例如在礼堂里做演讲,讲台上的座席通常只能有一个人在演讲,另外的人如果想要发言,得走上讲台,抢过发言权,抢过麦克风。

BFCP 这个协议在 RFC4582 中有详细的阐述。 实践中, 我们有 BFCP 控制者以及 BFCP 参与者的概念之分,好比辩论比赛的主持人(BFCP chair)和辩手(BFCP participant)。

RFC8855 后来废弃了 RFC4582, 在传输层可以使用 TCP 或者 UDP 来承载 BFCP, 在协议 RFC8856: Session Description Protocol (SDP) Format for Binary Floor Control Protocol (BFCP) Streams 中定义了 BFCP 的 SDP 格式

例如

m=application 50000 UDP/BFCP *

Role

  • c-only: The endpoint is willing to act as a floor control client. - 好比主持人

  • s-only: The endpoint is willing to act as a floor control server only - 好比辩手

Packet Format

BFCP packets consist of a 12-octet COMMON-HEADER followed by attributes. All the protocol values MUST be sent in network byte order.

COMMON-HEADER Format

The following is the format of the COMMON-HEADER.

   0                   1                   2                   3
   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | Ver |R|F| Res |  Primitive    |        Payload Length         |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                         Conference ID                         |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |         Transaction ID        |            User ID            |
+> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  | Fragment Offset (if F is set) | Fragment Length (if F is set) |
+> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+---- These fragment fields are never present
      when using reliable transports

BFCP Primitive

This 8-bit field identifies the main purpose of the message. The following primitive values are defined:

"BFCP Primitive"

Value

Primitive

Direction

1

FloorRequest

P -> S

2

FloorRelease

P -> S

3

FloorRequestQuery

P -> S ; Ch -> S

4

FloorRequestStatus

P <- S ; Ch <- S

5

UserQuery

P -> S ; Ch -> S

6

UserStatus

P <- S ; Ch <- S

7

FloorQuery

P -> S ; Ch -> S

8

FloorStatus

P <- S ; Ch <- S

9

ChairAction

Ch -> S

10

ChairActionAck

Ch <- S

11

Hello

P -> S ; Ch -> S

12

HelloAck

P <- S ; Ch <- S

13

Error

P <- S ; Ch <- S

14

FloorRequestStatusAck

P -> S ; Ch -> S

15

FloorStatusAck

P -> S ; Ch -> S

16

Goodbye

P -> S ; Ch -> S ; P <- S ; Ch <- S

17

GoodbyeAck

P -> S ; Ch -> S ; P <- S ; Ch <- S

  • S: Floor Control Server

  • P: Floor Participant

  • Ch: Floor Chair

Attribute Format

BFCP attributes are encoded in TLV (Type-Length-Value) format. Attributes are 32-bit aligned.

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|    Type     |M|    Length     |                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               |
|                                                               |
/                       Attribute Contents                      /
/                                                               /
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

BFCP Attributes

"BFCP Primitive"

Value

Attribute

Format

1

BENEFICIARY-ID

Unsigned16

2

FLOOR-ID

Unsigned16

3

FLOOR-REQUEST-ID

Unsigned16

4

PRIORITY

OctetString16

5

REQUEST-STATUS

OctetString16

6

ERROR-CODE

OctetString

7

ERROR-INFO

OctetString

8

PARTICIPANT-PROVIDED-INFO

OctetString

9

STATUS-INFO

OctetString

10

SUPPORTED-ATTRIBUTES

OctetString

11

SUPPORTED-PRIMITIVES

OctetString

12

USER-DISPLAY-NAME

OctetString

13

USER-URI

OctetString

14

BENEFICIARY-INFORMATION

Grouped

15

FLOOR-REQUEST-INFORMATION

Grouped

16

REQUESTED-BY-INFORMATION

Grouped

17

FLOOR-REQUEST-STATUS

Grouped

18

OVERALL-REQUEST-STATUS

Grouped

典型交互流程

以一个简单的发言权请求场景为例:

Participant(P)                       Server(S)                        Chair(Ch)
    |                                   |                                |
    |--- FloorRequest ----------------->|                                |
    |                                   |--- FloorRequestStatus -------->|
    |                                   |   (Status: Pending)            |
    |                                   |                                |
    |                                   |<--- ChairAction ---------------|
    |                                   |    (accept/deny)               |
    |                                   |--- ChairActionAck ------------>|
    |                                   |                                |
    |<-- FloorRequestStatus ------------|                                |
    |    (Status: Granted/Denied)       |                                |
    |                                   |                                |

发言权的状态可以是:

  • Pending:等待主席审批

  • Accepted:主席同意,等待发言权可用

  • Granted:已获得发言权

  • Denied:被拒绝

  • Cancelled:被取消

  • Released:已释放

  • Revoked:被撤销

在 WebRTC/SIP 中的应用

BFCP 主要用于视频会议系统中的内容共享(Content Sharing)场景。 在 SDP 中声明 BFCP 流:

m=application 50000 UDP/BFCP *
a=setup:actpass
a=connection:new
a=floorctrl:c-s
a=confid:4321
a=userid:1234
a=floorid:1 mstrm:2
m=video 50002 RTP/AVP 31
a=label:2

其中 a=floorid:1 mstrm:2 将 floor ID 1 关联到 label 为 2 的视频流(即内容共享流)。

参考资料

  • RFC 8855: The Binary Floor Control Protocol (BFCP)

  • RFC 8856: SDP Format for BFCP Streams

  • RFC 4582: The Binary Floor Control Protocol (已被 RFC 8855 废弃)