Skip to content

Commit

Permalink
Merge pull request mozilla#27 from martinthomson/sdp_stub
Browse files Browse the repository at this point in the history
Much
  • Loading branch information
ekr committed Sep 18, 2014
2 parents dbe9498 + 8142037 commit c9f6dff
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 84 deletions.
4 changes: 2 additions & 2 deletions media/webrtc/signaling/src/sdp/SdpAttribute.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ class SdpAttribute
kOtherAttribute
};

SdpAttribute(AttributeType type, std::string typeName) :
mType(type), mTypeName(typeName) {}
SdpAttribute(AttributeType type, const std::string& typeName)
: mType(type), mTypeName(typeName) {}
virtual ~SdpAttribute() {}

virtual AttributeType GetType()
Expand Down
14 changes: 7 additions & 7 deletions media/webrtc/signaling/src/sdp/SdpAttributeList.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ namespace mozilla {
class SdpAttributeList
{
public:
virtual unsigned int CountAttributes(sdp::AttributeType type) const = 0;
virtual bool HasAttribute(sdp::AttributeType type) const = 0;
typedef SdpAttribute::AttributeType AttributeType;

virtual UniquePtr<SdpAttribute>
GetAttribute(sdp::AttributeType type) const = 0;
virtual size_t CountAttributes(AttributeType type) const = 0;
virtual bool HasAttribute(AttributeType type) const = 0;
virtual const SdpAttribute& GetAttribute(AttributeType type, size_t index = 0) const = 0;

virtual const SdpCandidateAttribute& GetCandidate() const = 0;
virtual const SdpConnectionAttribute& GetConnection() const = 0;
Expand All @@ -36,11 +36,11 @@ class SdpAttributeList
virtual const SdpIdentityAttribute& GetIdentity() const = 0;
virtual const SdpImageattrAttribute& GetImageattr() const = 0;
virtual std::string GetLabel() const = 0;
virtual unsigned int GetMaxprate() const = 0;
virtual unsigned int GetMaxptime() const = 0;
virtual uint32_t GetMaxprate() const = 0;
virtual uint32_t GetMaxptime() const = 0;
virtual std::string GetMid() const = 0;
virtual const SdpMsidAttribute& GetMsid() const = 0;
virtual unsigned int GetPtime() const = 0;
virtual uint32_t GetPtime() const = 0;
virtual const SdpRtcpAttribute& GetRtcp() const = 0;
virtual const SdpRtcpFbAttribute& GetRtcpFb() const = 0;
virtual const SdpRemoteCandidatesAttribute& GetRemoteCandidates() const = 0;
Expand Down
19 changes: 14 additions & 5 deletions media/webrtc/signaling/src/sdp/SipccSdp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "signaling/src/sdp/SipccSdp.h"

#include "mozilla/Assertions.h"

namespace mozilla {

SdpOrigin
Expand All @@ -16,22 +18,29 @@ SipccSdp::GetSessionName() const {
return "TODO";
}

const Maybe<std::string>&
const Maybe<std::string>
SipccSdp::GetBandwidth(const std::string& type) const {
if (mBandwidths.count(type) > 0) {
return Nothing();
}
return Some(mBandwidths[type]);
}

const SdpMediaSection &
SipccSdp::GetMediaSection(unsigned int level) const
const SdpMediaSection&
SipccSdp::GetMediaSection(uint16_t level) const
{
if (level > mMediaSections.size()) {
MOZ_CRASH();
}
return mMediaSections[level];
}
SdpMediaSection &
SipccSdp::GetMediaSection(unsigned int level)

SdpMediaSection&
SipccSdp::GetMediaSection(uint16_t level)
{
if (level > mMediaSections.size()) {
MOZ_CRASH();
}
return mMediaSections[level];
}

Expand Down
8 changes: 2 additions & 6 deletions media/webrtc/signaling/src/sdp/SipccSdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ class SipccSdp MOZ_FINAL : public Sdp
{
friend class SipccSdpParser;
public:
~SipccSdp() {
sdp_free_description(mSdp);
}
~SipccSdp() {}

virtual const SdpOrigin& GetOrigin() const MOZ_OVERRIDE {
return *mOrigin;
Expand Down Expand Up @@ -58,9 +56,7 @@ class SipccSdp MOZ_FINAL : public Sdp
virtual SdpMediaSection &GetMediaSection(uint16_t level) MOZ_OVERRIDE;

private:
explicit SipccSdp(sdp_t* sdp) :
mSdp(sdp),
mAttributeList(sdp, 0) {}
explicit SipccSdp() {}

void Load(sdp_t* sdp);

Expand Down
95 changes: 48 additions & 47 deletions media/webrtc/signaling/src/sdp/SipccSdpAttributeList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,56 +6,58 @@

#include "signaling/src/sdp/SipccSdpAttributeList.h"

#include "mozilla/Assertions.h"

namespace mozilla {

unsigned int
SipccSdpAttributeList::CountAttributes(sdp::AttributeType type) const {
SipccSdpAttributeList::CountAttributes(AttributeType type) const {
return 0;
}

bool
SipccSdpAttributeList::HasAttribute(sdp::AttributeType type) const {
SipccSdpAttributeList::HasAttribute(AttributeType type) const {
return false;
}

UniquePtr<SdpAttribute>
SipccSdpAttributeList::GetAttribute(sdp::AttributeType type) const {
return nullptr;
const Maybe<SdpAttribute>
SipccSdpAttributeList::GetAttribute(AttributeType type, size_t index) const {
return Nothing();
}

UniquePtr<SdpCandidateAttribute>
const SdpCandidateAttribute&
SipccSdpAttributeList::GetCandidate() const {
return nullptr;
MOZ_CRASH()
}

UniquePtr<SdpConnectionAttribute>
const SdpConnectionAttribute&
SipccSdpAttributeList::GetConnection() const {
return nullptr;
MOZ_CRASH();
}

UniquePtr<SdpExtmapAttribute>
const SdpExtmapAttribute&
SipccSdpAttributeList::GetExtmap() const {
return nullptr;
MOZ_CRASH()
}

UniquePtr<SdpFingerprintAttribute>
const SdpFingerprintAttribute&
SipccSdpAttributeList::GetFingerprint() const {
return nullptr;
MOZ_CRASH()
}

UniquePtr<SdpFmtpAttribute>
const SdpFmtpAttribute&
SipccSdpAttributeList::GetFmtp() const {
return nullptr;
MOZ_CRASH()
}

UniquePtr<SdpGroupAttribute>
const SdpGroupAttribute&
SipccSdpAttributeList::GetGroup() const {
return nullptr;
MOZ_CRASH()
}

UniquePtr<SdpIceOptionsAttribute>
const SdpIceOptionsAttribute&
SipccSdpAttributeList::GetIceOptions() const {
return nullptr;
MOZ_CRASH()
}

std::string
Expand All @@ -68,27 +70,27 @@ SipccSdpAttributeList::GetIceUfrag() const {
return "";
}

UniquePtr<SdpIdentityAttribute>
const SdpIdentityAttribute&
SipccSdpAttributeList::GetIdentity() const {
return nullptr;
MOZ_CRASH();
}

UniquePtr<SdpImageattrAttribute>
const SdpImageattrAttribute&
SipccSdpAttributeList::GetImageattr() const {
return nullptr;
MOZ_CRASH();
}

std::string
SipccSdpAttributeList::GetLabel() const {
return "";
}

unsigned int
uint32_t
SipccSdpAttributeList::GetMaxprate() const {
return 0;
}

unsigned int
uint32_t
SipccSdpAttributeList::GetMaxptime() const {
return 0;
}
Expand All @@ -98,54 +100,54 @@ SipccSdpAttributeList::GetMid() const {
return "";
}

UniquePtr<SdpMsidAttribute>
const SdpMsidAttribute&
SipccSdpAttributeList::GetMsid() const {
return nullptr;
MOZ_CRASH();
}

unsigned int
uint32_t
SipccSdpAttributeList::GetPtime() const {
return 0;
}

UniquePtr<SdpRtcpAttribute>
const SdpRtcpAttribute&
SipccSdpAttributeList::GetRtcp() const {
return nullptr;
MOZ_CRASH();
}

UniquePtr<SdpRtcpFbAttribute>
const SdpRtcpFbAttribute&
SipccSdpAttributeList::GetRtcpFb() const {
return nullptr;
MOZ_CRASH();
}

//UniquePtr<SdpRtcpRemoteCandidates>
//SipccSdpAttributeList::GetRemoteCandidates() const {
// return nullptr;
//}
const SdpRemoteCandidatesAttribute&
SipccSdpAttributeList::GetRemoteCandidates() const {
MOZ_CRASH();
}

UniquePtr<SdpRtpmapAttribute>
const SdpRtpmapAttribute&
SipccSdpAttributeList::GetRtpmap() const {
return nullptr;
MOZ_CRASH();
}

UniquePtr<SdpSctpmapAttribute>
const SdpSctpmapAttribute&
SipccSdpAttributeList::GetSctpmap() const {
return nullptr;
MOZ_CRASH();
}

UniquePtr<SdpSetupAttribute>
const SdpSetupAttribute&
SipccSdpAttributeList::GetSetup() const {
return nullptr;
MOZ_CRASH();
}

UniquePtr<SdpSsrcAttribute>
const SdpSsrcAttribute&
SipccSdpAttributeList::GetSsrc() const {
return nullptr;
MOZ_CRASH();
}

UniquePtr<SdpSsrcGroupAttribute>
const SdpSsrcGroupAttribute&
SipccSdpAttributeList::GetSsrcGroup() const {
return nullptr;
MOZ_CRASH();
}

void
Expand All @@ -154,4 +156,3 @@ SipccSdpAttributeList::SetAttribute(const SdpAttribute &) {


} // namespace mozilla

18 changes: 8 additions & 10 deletions media/webrtc/signaling/src/sdp/SipccSdpAttributeList.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#ifndef _SIPCCSDPATTRIBUTELIST_H_
#define _SIPCCSDPATTRIBUTELIST_H_

#include "signaling/src/sdp/SdpAttributeList.h"
#include "signaling/src/sdp/SdpAttribute.h"
extern "C" {
#include "signaling/src/sdp/sipcc/sdp.h"
}
Expand All @@ -22,11 +22,9 @@ class SipccSdpAttributeList : public SdpAttributeList
friend class SipccSdpMediaSection;
friend class SipccSdp;
public:
virtual unsigned int CountAttributes(sdp::AttributeType type) const MOZ_OVERRIDE;
virtual bool HasAttribute(sdp::AttributeType type) const MOZ_OVERRIDE;

virtual UniquePtr<SdpAttribute>
GetAttribute(sdp::AttributeType type) const MOZ_OVERRIDE;
virtual size_t CountAttributes(AttributeType type) const MOZ_OVERRIDE;
virtual bool HasAttribute(AttributeType type) const MOZ_OVERRIDE;
virtual const SdpAttribute& GetAttribute(AttributeType type, size_t index = 0) const MOZ_OVERRIDE;

virtual const SdpCandidateAttribute& GetCandidate() const MOZ_OVERRIDE;
virtual const SdpConnectionAttribute& GetConnection() const MOZ_OVERRIDE;
Expand All @@ -40,14 +38,14 @@ class SipccSdpAttributeList : public SdpAttributeList
virtual const SdpIdentityAttribute& GetIdentity() const MOZ_OVERRIDE;
virtual const SdpImageattrAttribute& GetImageattr() const MOZ_OVERRIDE;
virtual const std::string& GetLabel() const MOZ_OVERRIDE;
virtual unsigned int GetMaxprate() const MOZ_OVERRIDE;
virtual unsigned int GetMaxptime() const MOZ_OVERRIDE;
virtual uint32_t GetMaxprate() const MOZ_OVERRIDE;
virtual uint32_t GetMaxptime() const MOZ_OVERRIDE;
virtual const std::string& GetMid() const MOZ_OVERRIDE;
virtual const SdpMsidAttribute& GetMsid() const MOZ_OVERRIDE;
virtual unsigned int GetPtime() const MOZ_OVERRIDE;
virtual uint32_t GetPtime() const MOZ_OVERRIDE;
virtual const SdpRtcpAttribute& GetRtcp() const MOZ_OVERRIDE;
virtual const SdpRtcpFbAttribute& GetRtcpFb() const MOZ_OVERRIDE;
// virtual const SdpRtcpRemoteCandidates& GetRemoteCandidates() const MOZ_OVERRIDE;
virtual const SdpRemoteCandidatesAttribute& GetRemoteCandidates() const MOZ_OVERRIDE;
virtual const SdpRtpmapAttribute& GetRtpmap() const MOZ_OVERRIDE;
virtual const SdpSctpmapAttribute& GetSctpmap() const MOZ_OVERRIDE;
virtual const SdpSetupAttribute& GetSetup() const MOZ_OVERRIDE;
Expand Down
2 changes: 1 addition & 1 deletion media/webrtc/signaling/src/sdp/SipccSdpMediaSection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ SipccSdpMediaSection::GetPortCount() const {
return mPortCount;
}

sdp::Protocol
Protocol
SipccSdpMediaSection::GetProtocol() const {
return mProtocol;
}
Expand Down
8 changes: 2 additions & 6 deletions media/webrtc/signaling/src/sdp/SipccSdpMediaSection.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class SipccSdpMediaSection MOZ_FINAL : public SdpMediaSection

virtual unsigned int GetPort() const MOZ_OVERRIDE;
virtual unsigned int GetPortCount() const MOZ_OVERRIDE;
virtual sdp::Protocol GetProtocol() const MOZ_OVERRIDE;
virtual Protocol GetProtocol() const MOZ_OVERRIDE;
virtual SdpConnection GetConnection() const MOZ_OVERRIDE;
virtual Maybe<std::string> GetBandwidth(const std::string& type) const MOZ_OVERRIDE;
virtual std::vector<std::string> GetFormats() const MOZ_OVERRIDE;
Expand All @@ -44,11 +44,7 @@ class SipccSdpMediaSection MOZ_FINAL : public SdpMediaSection
virtual SdpAttributeList &GetAttributeList() MOZ_OVERRIDE;

private:
SipccSdpMediaSection(sdp_t* sdp, uint16_t level)
: mSdp(sdp),
mLevel(level),
mAttributes(sdp, level),
mConnection(sdp::kInternet, sdp::kIPv4, "0.0.0.0") {}
SipccSdpMediaSection() {}

void Load(sdp_t* sdp, uint16_t level);
void LoadConnection(sdp_t* sdp, uint16_t level);
Expand Down
1 change: 1 addition & 0 deletions media/webrtc/signaling/src/sdp/SipccSdpParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ SipccSdpParser::Parse(const std::string& sdpText)
if (result == SDP_SUCCESS) {
SipccSdp* sipccSdp = new SipccSdp();
sipccSdp->Load(sdp);
sdp_free_description(sdp);
return UniquePtr<Sdp, DefaultDelete<Sdp>>(sipccSdp);
}

Expand Down

0 comments on commit c9f6dff

Please sign in to comment.