This document describes the tooling and process for deprecating and eventually removing Plan B SDP semantics from the WebRTC codebase.
To support a gradual deprecation, a new GN argument and C++ macro have been introduced.
deprecate_plan_bDefined in webrtc.gni, this argument controls whether Plan B specific APIs are marked as deprecated at compile time.
false (default): Plan B APIs are available without warnings.true: Plan B APIs are annotated with [[deprecated]]. In WebRTC's default build configuration (which treats warnings as errors), this will cause compilation to fail if any Plan B APIs are used.To enable this in your local build, add the following to your args.gn:
deprecate_plan_b = true
PLAN_B_ONLYDefined in rtc_base/system/plan_b_only.h, this macro should be used to annotate functions, classes, or variables that are only needed for Plan B semantics.
#include "rtc_base/system/plan_b_only.h" PLAN_B_ONLY void MyPlanBSpecificFunction();
deprecate_plan_b is true, PLAN_B_ONLY expands to [[deprecated]].deprecate_plan_b is false, PLAN_B_ONLY expands to an empty string.To allow existing Plan B code to compile when deprecate_plan_b = true, the following macros are provided in rtc_base/system/plan_b_only.h:
RTC_ALLOW_PLAN_B_DEPRECATION_BEGIN()RTC_ALLOW_PLAN_B_DEPRECATION_END()These macros use compiler pragmas to locally disable deprecation warnings.
Avoid adding new Plan B code. If it is absolutely necessary, ensure it is annotated with the PLAN_B_ONLY macro.
By setting deprecate_plan_b = true, developers can identify all call sites that still rely on Plan B. This is the primary method for auditing the progress of the migration to Unified Plan.
Existing Plan B call sites in “glue code” (e.g., PeerConnection delegation logic) should be wrapped with the suppression macros to allow the build to pass.
RTC_ALLOW_PLAN_B_DEPRECATION_BEGIN(); sdp_handler_->RemoveStream(local_stream); RTC_ALLOW_PLAN_B_DEPRECATION_END();
This ensures that the build only fails on new, unwrapped Plan B usage, while clearly marking legacy code that requires migration.
Functions that are compatible with both Plan B and Unified Plan should not be annotated. Only those that are functionally incorrect or redundant under Unified Plan (often guarded by RTC_DCHECK(!IsUnifiedPlan())) should be marked.