Closed Bug 1142105 Opened 9 years ago Closed 9 years ago

Move SDP helper code from the jsep code where possible

Categories

(Core :: WebRTC: Signaling, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla42
Tracking Status
firefox42 --- fixed
backlog tech-debt

People

(Reporter: bwc, Assigned: bwc)

Details

Attachments

(1 file, 2 obsolete files)

There is a bunch of SDP helper code scattered around the jsep code. It would be good to consolidate it, and move it to the sdp directory.
backlog: --- → tech-debt
Rank: 25
Priority: -- → P2
Bug 1142105 - Part 1: Move SDP helper code functions out of JsepSessionImpl and into a separate class.
Attachment #8630111 - Flags: review?(martin.thomson)
Comment on attachment 8630111 [details]
MozReview Request: Bug 1142105 - Part 2: Move some stuff from JsepCodecDescription into /sdp

Bug 1142105 - Part 1: Move SDP helper code functions out of JsepSessionImpl and into a separate class.
I'd like to review and land piecemeal here, to keep bitrot under control. First patch is just some bulk moves. More complicated refactoring to extract more functionality will come in a later patch.
Whiteboard: [keep-open]
Assignee: nobody → docfaraday
Attachment #8630111 - Flags: review?(martin.thomson) → review+
Comment on attachment 8630111 [details]
MozReview Request: Bug 1142105 - Part 2: Move some stuff from JsepCodecDescription into /sdp

https://reviewboard.mozilla.org/r/12679/#review11299

::: media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp:638
(Diff revision 1)
> -  rv = SetupTransportAttributes(*sdp, sdp.get());
> +  if (GetAnswer()) {
> +    // We have an old answer from a previous negotiation
> +    rv = SetupTransportParams(*GetAnswer(), *sdp, sdp.get());
> -  NS_ENSURE_SUCCESS(rv,rv);
> +    NS_ENSURE_SUCCESS(rv,rv);
> +  }

This looks like more than a refactor.
https://reviewboard.mozilla.org/r/12679/#review11299

> This looks like more than a refactor.

Yeah, this was a tiny bit more than just moving code. I renamed SetupTransportAttributes to SetupTransportParams (for consistency), moved the GetAnswer() check out of it (since that was all that was necessary to make it movable), and moved the resulting function to SdpHelper. Let me know if that matches what you see.
Keywords: leave-open
Whiteboard: [keep-open]
Check back on try.
Flags: needinfo?(docfaraday)
Comment on attachment 8630111 [details]
MozReview Request: Bug 1142105 - Part 2: Move some stuff from JsepCodecDescription into /sdp

Bug 1142105 - Part 1: Move SDP helper code functions out of JsepSessionImpl and into a separate class.
Attachment #8630111 - Flags: review+ → review?(martin.thomson)
Comment on attachment 8630111 [details]
MozReview Request: Bug 1142105 - Part 2: Move some stuff from JsepCodecDescription into /sdp

https://reviewboard.mozilla.org/r/12679/#review11847

I seem to be victim of reviewboard repeat review request recursion.
Attachment #8630111 - Flags: review?(martin.thomson) → review+
Flags: needinfo?(docfaraday)
Keywords: checkin-needed
Attachment #8630111 - Attachment description: MozReview Request: Bug 1142105 - Part 1: Move SDP helper code functions out of JsepSessionImpl and into a separate class. → MozReview Request: Bug 1142105 - Part 2: Move some stuff from JsepCodecDescription into /sdp
Attachment #8630111 - Flags: review+ → review?(martin.thomson)
Comment on attachment 8630111 [details]
MozReview Request: Bug 1142105 - Part 2: Move some stuff from JsepCodecDescription into /sdp

Bug 1142105 - Part 2: Move some stuff from JsepCodecDescription into /sdp
Ok, mozreview did not do what I expected it to do there, and the interdiff is completely bogus.
Attachment #8630111 - Attachment is obsolete: true
Attachment #8630111 - Flags: review?(martin.thomson)
Bug 1142105 - Part 2: Move some stuff from JsepCodecDescription into /sdp
Attachment #8638163 - Flags: review?(martin.thomson)
Hi :bwc, if the system wide nspr is installed at a custom path, |#include "nspr/prprf.h"| at line 13 of /media/webrtc/signaling/src/sdp/SdpHelper.cpp will break building with system nspr, switching to |#include "prprf.h"| should fix it. Thanks!
https://reviewboard.mozilla.org/r/14035/#review12615

LGTM.

::: media/webrtc/signaling/src/jsep/JsepCodecDescription.h:58
(Diff revision 1)
> -    const SdpRtpmapAttributeList& rtpmap = attrs.GetRtpmap();
> +    const SdpRtpmapAttributeList::Rtpmap* entry(remoteMsection.FindRtpmap(fmt));

Do we have guidance on
    Foo x(y);
vs
    Foo x = y;
?

Assignment of a pointer doesn't seem to need this treatment.

::: media/webrtc/signaling/src/sdp/SdpMediaSection.h:152
(Diff revision 1)
> +  FindParameters(const std::string& pt) const

FindFmtpParameters or FindFmtp
Comment on attachment 8638163 [details]
MozReview Request: Bug 1142105 - Part 2: Move some stuff from JsepCodecDescription into /sdp r=mt

Good work here.
Attachment #8638163 - Flags: review?(martin.thomson) → review+
(In reply to Hector Zhao [:hectorz] from comment #14)
> Hi :bwc, if the system wide nspr is installed at a custom path, |#include
> "nspr/prprf.h"| at line 13 of /media/webrtc/signaling/src/sdp/SdpHelper.cpp
> will break building with system nspr, switching to |#include "prprf.h"|
> should fix it. Thanks!

I'll put this into part 2, thanks for the heads-up!
Comment on attachment 8638163 [details]
MozReview Request: Bug 1142105 - Part 2: Move some stuff from JsepCodecDescription into /sdp r=mt

Bug 1142105 - Part 2: Move some stuff from JsepCodecDescription into /sdp r=mt
Attachment #8638163 - Attachment description: MozReview Request: Bug 1142105 - Part 2: Move some stuff from JsepCodecDescription into /sdp → MozReview Request: Bug 1142105 - Part 2: Move some stuff from JsepCodecDescription into /sdp r=mt
Attachment #8638163 - Flags: review+ → review?(martin.thomson)
Comment on attachment 8638163 [details]
MozReview Request: Bug 1142105 - Part 2: Move some stuff from JsepCodecDescription into /sdp r=mt

Carry forward r=mt
Attachment #8638163 - Flags: review?(martin.thomson) → review+
Attachment #8638163 - Flags: review+ → review?(martin.thomson)
Comment on attachment 8638163 [details]
MozReview Request: Bug 1142105 - Part 2: Move some stuff from JsepCodecDescription into /sdp r=mt

Bug 1142105 - Part 2: Move some stuff from JsepCodecDescription into /sdp r=mt
Attachment #8638163 - Flags: review?(martin.thomson) → review+
Comment on attachment 8638163 [details]
MozReview Request: Bug 1142105 - Part 2: Move some stuff from JsepCodecDescription into /sdp r=mt

https://reviewboard.mozilla.org/r/14037/#review12945

Ship It!
Attachment #8638163 - Attachment is obsolete: true
Bug 1142105 - Part 3: Extract more SDP-related functionality out of JsepSessionImpl, and some readability improvements.
Attachment #8640624 - Flags: review?(martin.thomson)
Comment on attachment 8640624 [details]
MozReview Request: Bug 1142105 - Part 3: Extract more SDP-related functionality out of JsepSessionImpl, and some readability improvements. r=mt

https://reviewboard.mozilla.org/r/14347/#review13021

Ship It!

::: media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp:780
(Diff revision 1)
> -  UniquePtr<SdpExtmapAttributeList> ourExtmap(new SdpExtmapAttributeList);
> +  mSdpHelper.AddCommonExtmaps(remoteMsection, *ourExtensions, msection);

Early return seems less obvious now.

::: media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp:609
(Diff revision 1)
> +  // Undo track assignments from a previous call to CreateOffer

The change in comment loses the fact that this is only for non-negotiated msections.

::: media/webrtc/signaling/src/sdp/SdpHelper.cpp:285
(Diff revision 1)
> +  if (!bundledMids.empty()) {

I would remove this outer check, since you are calling bundledMids.count(mid) below.  Even though this might avoid some tiny amount of work, we don't need this to be super-performant.
Attachment #8640624 - Flags: review?(martin.thomson) → review+
Attachment #8640624 - Attachment description: MozReview Request: Bug 1142105 - Part 3: Extract more SDP-related functionality out of JsepSessionImpl, and some readability improvements. → MozReview Request: Bug 1142105 - Part 3: Extract more SDP-related functionality out of JsepSessionImpl, and some readability improvements. r=mt
Comment on attachment 8640624 [details]
MozReview Request: Bug 1142105 - Part 3: Extract more SDP-related functionality out of JsepSessionImpl, and some readability improvements. r=mt

Bug 1142105 - Part 3: Extract more SDP-related functionality out of JsepSessionImpl, and some readability improvements. r=mt
Check back on try
Flags: needinfo?(docfaraday)
Was there anything else you'd like to see done as part of this bug?
Flags: needinfo?(docfaraday) → needinfo?(martin.thomson)
Keywords: checkin-needed
Nah, this looks like a good start.  JsepSessionImpl is still too large, but the next cut is a harder one, and one that can use another bug.  That cut might be to remove ICE handling, but that's probably quite a lot more work.
Flags: needinfo?(martin.thomson)
Keywords: leave-open
https://hg.mozilla.org/mozilla-central/rev/b1b3c99e1756
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: