From c7fc09f5bdd9430fec16f887f639a41f8a08a26d Mon Sep 17 00:00:00 2001 From: thesyncim Date: Thu, 14 Nov 2024 12:24:15 +0000 Subject: [PATCH] fix proto breaking change --- generate.sh | 12 ++-- protobuf/video/sfu/models/models.pb.go | 9 +-- protobuf/video/sfu/models/models.proto | 2 +- .../video/sfu/models/models_vtproto.pb.go | 56 ++++++++++--------- 4 files changed, 39 insertions(+), 40 deletions(-) diff --git a/generate.sh b/generate.sh index c6f7acb4..8af5c0fd 100755 --- a/generate.sh +++ b/generate.sh @@ -7,11 +7,13 @@ PB=$REPO/protobuf export PATH=/opt/.protoc/bin:$PWD/.protoc/bin:$PATH -REALPATH=${REALPATH:-$(if [[ "$OSTYPE" == "darwin"* ]]; then echo "grealpath"; else echo "realpath"; fi)} -if ! command -v $REALPATH &> /dev/null; then - echo "$REALPATH command not found. Please install it and try again." - exit 1 -fi +# In some systems like Mac OS 13.0.1, the realpath defaults to +# the system installed one which does not support flags like +# --relative-path. This results in the scripts erroring out. +# The coreutils installed with Homebrew (as mentioned in README) +# installs GNU realpath which could be available as "grealpath" +# which actually works. Hence, the option to customize REALPATH +REALPATH=${REALPATH:-realpath} GEN_PROFILE=${1:-go} diff --git a/protobuf/video/sfu/models/models.pb.go b/protobuf/video/sfu/models/models.pb.go index b1af1bbc..80aabb5c 100644 --- a/protobuf/video/sfu/models/models.pb.go +++ b/protobuf/video/sfu/models/models.pb.go @@ -1419,17 +1419,12 @@ func (x *PublishOption) GetMaxTemporalLayers() int32 { return 0 } -// message Codec { -// string mime_type = 10; -// string scalability_mode = 11; -// string fmtp = 12; -// } type Codec struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - PayloadType uint32 `protobuf:"varint,13,opt,name=payload_type,json=payloadType,proto3" json:"payload_type,omitempty"` + PayloadType uint32 `protobuf:"varint,16,opt,name=payload_type,json=payloadType,proto3" json:"payload_type,omitempty"` Name string `protobuf:"bytes,10,opt,name=name,proto3" json:"name,omitempty"` ClockRate uint32 `protobuf:"varint,14,opt,name=clock_rate,json=clockRate,proto3" json:"clock_rate,omitempty"` EncodingParameters string `protobuf:"bytes,15,opt,name=encoding_parameters,json=encodingParameters,proto3" json:"encoding_parameters,omitempty"` @@ -2508,7 +2503,7 @@ var file_video_sfu_models_models_proto_rawDesc = []byte{ 0x01, 0x28, 0x05, 0x52, 0x11, 0x6d, 0x61, 0x78, 0x54, 0x65, 0x6d, 0x70, 0x6f, 0x72, 0x61, 0x6c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x22, 0xa2, 0x01, 0x0a, 0x05, 0x43, 0x6f, 0x64, 0x65, 0x63, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x54, + 0x18, 0x10, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x63, 0x6c, 0x6f, diff --git a/protobuf/video/sfu/models/models.proto b/protobuf/video/sfu/models/models.proto index 5d62f05a..9ea5a064 100644 --- a/protobuf/video/sfu/models/models.proto +++ b/protobuf/video/sfu/models/models.proto @@ -122,7 +122,7 @@ message PublishOption { } message Codec { - uint32 payload_type = 13; + uint32 payload_type = 16; string name = 10; uint32 clock_rate = 14; string encoding_parameters = 15; diff --git a/protobuf/video/sfu/models/models_vtproto.pb.go b/protobuf/video/sfu/models/models_vtproto.pb.go index 9d675a5e..3487abf6 100644 --- a/protobuf/video/sfu/models/models_vtproto.pb.go +++ b/protobuf/video/sfu/models/models_vtproto.pb.go @@ -671,6 +671,13 @@ func (m *Codec) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } + if m.PayloadType != 0 { + i = encodeVarint(dAtA, i, uint64(m.PayloadType)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x80 + } if len(m.EncodingParameters) > 0 { i -= len(m.EncodingParameters) copy(dAtA[i:], m.EncodingParameters) @@ -683,11 +690,6 @@ func (m *Codec) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i-- dAtA[i] = 0x70 } - if m.PayloadType != 0 { - i = encodeVarint(dAtA, i, uint64(m.PayloadType)) - i-- - dAtA[i] = 0x68 - } if len(m.Fmtp) > 0 { i -= len(m.Fmtp) copy(dAtA[i:], m.Fmtp) @@ -1834,9 +1836,6 @@ func (m *Codec) SizeVT() (n int) { if l > 0 { n += 1 + l + sov(uint64(l)) } - if m.PayloadType != 0 { - n += 1 + sov(uint64(m.PayloadType)) - } if m.ClockRate != 0 { n += 1 + sov(uint64(m.ClockRate)) } @@ -1844,6 +1843,9 @@ func (m *Codec) SizeVT() (n int) { if l > 0 { n += 1 + l + sov(uint64(l)) } + if m.PayloadType != 0 { + n += 2 + sov(uint64(m.PayloadType)) + } if m.unknownFields != nil { n += len(m.unknownFields) } @@ -3801,25 +3803,6 @@ func (m *Codec) UnmarshalVT(dAtA []byte) error { } m.Fmtp = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 13: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PayloadType", wireType) - } - m.PayloadType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PayloadType |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } case 14: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ClockRate", wireType) @@ -3871,6 +3854,25 @@ func (m *Codec) UnmarshalVT(dAtA []byte) error { } m.EncodingParameters = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 16: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PayloadType", wireType) + } + m.PayloadType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PayloadType |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:])