mirror of
				https://github.com/pion/webrtc.git
				synced 2025-10-31 18:52:55 +08:00 
			
		
		
		
	 88448e5e74
			
		
	
	88448e5e74
	
	
	
		
			
			By default, we should be using unified-plan as the SDP format of choice. This patch adds a PeerConnection configuration option to allow the user to specify that they want plan-b only, unified-plan only, or a special compatibility mode where a plan-b answer will be generated IFF a plan-b offer is received.
		
			
				
	
	
		
			42 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| package webrtc
 | |
| 
 | |
| // SDPSemantics determines which style of SDP offers and answers
 | |
| // can be used
 | |
| type SDPSemantics int
 | |
| 
 | |
| const (
 | |
| 	// SDPSemanticsUnifiedPlan uses unified-plan offers and answers
 | |
| 	// (the default in Chrome since M72)
 | |
| 	// https://tools.ietf.org/html/draft-roach-mmusic-unified-plan-00
 | |
| 	SDPSemanticsUnifiedPlan SDPSemantics = iota
 | |
| 
 | |
| 	// SDPSemanticsPlanB uses plan-b offers and answers
 | |
| 	// NB: This format should be considered deprecated
 | |
| 	// https://tools.ietf.org/html/draft-uberti-rtcweb-plan-00
 | |
| 	SDPSemanticsPlanB
 | |
| 
 | |
| 	// SDPSemanticsUnifiedPlanWithFallback prefers unified-plan
 | |
| 	// offers and answers, but will respond to a plan-b offer
 | |
| 	// with a plan-b answer
 | |
| 	SDPSemanticsUnifiedPlanWithFallback
 | |
| )
 | |
| 
 | |
| const (
 | |
| 	sdpSemanticsUnifiedPlanWithFallback = "unified-plan-with-fallback"
 | |
| 	sdpSemanticsUnifiedPlan             = "unified-plan"
 | |
| 	sdpSemanticsPlanB                   = "plan-b"
 | |
| )
 | |
| 
 | |
| func (s SDPSemantics) String() string {
 | |
| 	switch s {
 | |
| 	case SDPSemanticsUnifiedPlanWithFallback:
 | |
| 		return sdpSemanticsUnifiedPlanWithFallback
 | |
| 	case SDPSemanticsUnifiedPlan:
 | |
| 		return sdpSemanticsUnifiedPlan
 | |
| 	case SDPSemanticsPlanB:
 | |
| 		return sdpSemanticsPlanB
 | |
| 	default:
 | |
| 		return ErrUnknownType.Error()
 | |
| 	}
 | |
| }
 |