Skip to content

Commit c0ffee7

Browse files
committed
refactor: unify payload property
1 parent c0ffee6 commit c0ffee7

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/attributes/rtpmap.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fn test_read_p_time() {
5252
serde(rename_all = "camelCase")
5353
)]
5454
pub struct RtpMap<'a> {
55-
pub payload_type: u32,
55+
pub payload: u32,
5656
pub encoding_name: Cow<'a, str>,
5757
pub clock_rate: Option<u32>,
5858
pub encoding: Option<u32>,
@@ -71,8 +71,8 @@ pub fn rtpmap_line(input: &str) -> IResult<&str, RtpMap> {
7171
read_number, // encoding
7272
)),
7373
)),
74-
|(payload_type, encoding_name, clock_rate, encoding)| RtpMap {
75-
payload_type,
74+
|(payload, encoding_name, clock_rate, encoding)| RtpMap {
75+
payload,
7676
encoding_name,
7777
clock_rate,
7878
encoding,
@@ -87,7 +87,7 @@ fn test_rtpmap_line() {
8787
rtpmap_line,
8888
"a=rtpmap:96 VP8/90000",
8989
RtpMap {
90-
payload_type: 96,
90+
payload: 96,
9191
encoding_name: "VP8".into(),
9292
clock_rate: Some(90000),
9393
encoding: None,
@@ -98,7 +98,7 @@ fn test_rtpmap_line() {
9898
rtpmap_line,
9999
"a=rtpmap:97 rtx/90000",
100100
RtpMap {
101-
payload_type: 97,
101+
payload: 97,
102102
encoding_name: "rtx".into(),
103103
clock_rate: Some(90000),
104104
encoding: None,
@@ -109,7 +109,7 @@ fn test_rtpmap_line() {
109109
rtpmap_line,
110110
"a=rtpmap:111 opus/48000/2",
111111
RtpMap {
112-
payload_type: 111,
112+
payload: 111,
113113
encoding_name: "opus".into(),
114114
clock_rate: Some(48000),
115115
encoding: Some(2),
@@ -129,7 +129,7 @@ fn test_rtpmap_line() {
129129
rtpmap_line,
130130
"a=rtpmap:113 telephone-event/16000",
131131
RtpMap {
132-
payload_type: 113,
132+
payload: 113,
133133
encoding_name: "telephone-event".into(),
134134
clock_rate: Some(16000),
135135
encoding: None,

src/display.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ impl fmt::Display for Ssrc<'_> {
246246
}
247247
impl fmt::Display for RtpMap<'_> {
248248
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
249-
write!(f, "a=rtpmap:{} {}", self.payload_type, self.encoding_name)?;
249+
write!(f, "a=rtpmap:{} {}", self.payload, self.encoding_name)?;
250250
if let Some(clock_rate) = self.clock_rate {
251251
write!(f, "/{}", clock_rate)?;
252252
}

src/udisplay.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ impl ufmt::uDisplay for RtpMap<'_> {
376376
uwrite!(
377377
f,
378378
"a=rtpmap:{} {}",
379-
self.payload_type,
379+
self.payload,
380380
self.encoding_name.as_ref()
381381
)?;
382382
if let Some(clock_rate) = self.clock_rate {

0 commit comments

Comments
 (0)