mirror of
				https://github.com/pion/webrtc.git
				synced 2025-11-01 03:04:06 +08:00 
			
		
		
		
	 5655d151b1
			
		
	
	5655d151b1
	
	
	
		
			
			This will be returned by Unmarhsal when an unknown type is seen in the packet stream, avoiding an error and allowing the user to write their own packet handling code for that type if desired. Relates to #119
		
			
				
	
	
		
			26 lines
		
	
	
		
			520 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			520 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package rtcp
 | |
| 
 | |
| // RawPacket represents an unparsed RTCP packet. It's returned by Unmarshal when
 | |
| // a packet with an unknown type is encountered.
 | |
| type RawPacket []byte
 | |
| 
 | |
| // Marshal encodes the packet in binary.
 | |
| func (r RawPacket) Marshal() ([]byte, error) {
 | |
| 	return r, nil
 | |
| }
 | |
| 
 | |
| // Unmarshal decodes the packet from binary.
 | |
| func (r *RawPacket) Unmarshal(b []byte) error {
 | |
| 	if len(b) < (headerLength) {
 | |
| 		return errPacketTooShort
 | |
| 	}
 | |
| 	*r = b
 | |
| 
 | |
| 	var h Header
 | |
| 	if err := h.Unmarshal(b); err != nil {
 | |
| 		return err
 | |
| 	}
 | |
| 
 | |
| 	return nil
 | |
| }
 |