зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1570549 - P6 - Use hybrid parser in JsepSessionImpl; r=bwc
Differential Revision: https://phabricator.services.mozilla.com/D52328 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
94a27a1007
Коммит
44bb324bfb
|
@ -25,12 +25,11 @@
|
|||
|
||||
#include "signaling/src/jsep/JsepTrack.h"
|
||||
#include "signaling/src/jsep/JsepTransport.h"
|
||||
#include "signaling/src/sdp/RsdparsaSdpParser.h"
|
||||
#include "signaling/src/sdp/Sdp.h"
|
||||
|
||||
#include "signaling/src/sdp/HybridSdpParser.h"
|
||||
#include "signaling/src/sdp/SipccSdp.h"
|
||||
#include "signaling/src/sdp/SipccSdpParser.h"
|
||||
|
||||
#include "mozilla/net/DataChannelProtocol.h"
|
||||
#include "signaling/src/sdp/ParsingResultComparer.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -83,11 +82,6 @@ nsresult JsepSessionImpl::Init() {
|
|||
SetupDefaultCodecs();
|
||||
SetupDefaultRtpExtensions();
|
||||
|
||||
mRunRustParser =
|
||||
Preferences::GetBool("media.peerconnection.sdp.rust.enabled", false);
|
||||
mRunSdpComparer =
|
||||
Preferences::GetBool("media.peerconnection.sdp.rust.compare", false);
|
||||
|
||||
mEncodeTrackId =
|
||||
Preferences::GetBool("media.peerconnection.sdp.encode_track_id", true);
|
||||
|
||||
|
@ -1194,26 +1188,15 @@ nsresult JsepSessionImpl::CopyPreviousTransportParams(
|
|||
|
||||
nsresult JsepSessionImpl::ParseSdp(const std::string& sdp,
|
||||
UniquePtr<Sdp>* parsedp) {
|
||||
UniquePtr<Sdp> parsed = mSipccParser.Parse(sdp);
|
||||
auto results = mParser->Parse(sdp);
|
||||
auto parsed = std::move(results->Sdp());
|
||||
auto errors = results->Errors();
|
||||
if (!parsed) {
|
||||
std::string error = "Failed to parse SDP: ";
|
||||
mSdpHelper.appendSdpParseErrors(mSipccParser.GetParseErrors(), &error);
|
||||
std::string error = results->ParserName() + " Failed to parse SDP: ";
|
||||
mSdpHelper.appendSdpParseErrors(errors, &error);
|
||||
JSEP_SET_ERROR(error);
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
if (mRunRustParser) {
|
||||
UniquePtr<Sdp> rustParsed = mRsdparsaParser.Parse(sdp);
|
||||
if (mRunSdpComparer) {
|
||||
ParsingResultComparer comparer;
|
||||
if (rustParsed) {
|
||||
comparer.Compare(*rustParsed, *parsed, sdp);
|
||||
} else {
|
||||
comparer.TrackRustParsingFailed(mSipccParser.GetParseErrors().size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Verify that the JSEP rules for all SDP are followed
|
||||
for (size_t i = 0; i < parsed->GetMediaSectionCount(); ++i) {
|
||||
if (mSdpHelper.MsectionIsDisabled(parsed->GetMediaSection(i))) {
|
||||
|
|
|
@ -14,8 +14,7 @@
|
|||
#include "signaling/src/jsep/JsepTrack.h"
|
||||
#include "signaling/src/jsep/JsepTransceiver.h"
|
||||
#include "signaling/src/jsep/SsrcGenerator.h"
|
||||
#include "signaling/src/sdp/RsdparsaSdpParser.h"
|
||||
#include "signaling/src/sdp/SipccSdpParser.h"
|
||||
#include "signaling/src/sdp/HybridSdpParser.h"
|
||||
#include "signaling/src/sdp/SdpHelper.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -41,8 +40,7 @@ class JsepSessionImpl : public JsepSession {
|
|||
mTransportIdCounter(0),
|
||||
mUuidGen(std::move(uuidgen)),
|
||||
mSdpHelper(&mLastError),
|
||||
mRunRustParser(false),
|
||||
mRunSdpComparer(false),
|
||||
mParser(new HybridSdpParser()),
|
||||
mEncodeTrackId(true) {}
|
||||
|
||||
// Implement JsepSession methods.
|
||||
|
@ -260,13 +258,10 @@ class JsepSessionImpl : public JsepSession {
|
|||
UniquePtr<Sdp> mPendingRemoteDescription;
|
||||
std::vector<UniquePtr<JsepCodecDescription>> mSupportedCodecs;
|
||||
std::string mLastError;
|
||||
SipccSdpParser mSipccParser;
|
||||
SdpHelper mSdpHelper;
|
||||
UniquePtr<SdpParser> mParser;
|
||||
SsrcGenerator mSsrcGenerator;
|
||||
bool mRunRustParser;
|
||||
bool mRunSdpComparer;
|
||||
bool mEncodeTrackId;
|
||||
RsdparsaSdpParser mRsdparsaParser;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
Загрузка…
Ссылка в новой задаче