diff --git a/media/webrtc/signaling/src/sdp/Sdp.h b/media/webrtc/signaling/src/sdp/Sdp.h index eb670c39487f4..c37a8c5f35cce 100644 --- a/media/webrtc/signaling/src/sdp/Sdp.h +++ b/media/webrtc/signaling/src/sdp/Sdp.h @@ -30,8 +30,7 @@ class Sdp virtual const SdpOrigin& GetOrigin() const = 0; virtual const std::string& GetSessionName() const = 0; // Note: connection information is always retrieved from media sections - virtual const Maybe& - GetBandwidth(const std::string& type) const = 0; + virtual const std::string& GetBandwidth(const std::string& type) const = 0; virtual const SdpAttributeList &GetAttributeList() const = 0; virtual SdpAttributeList &GetAttributeList() = 0; diff --git a/media/webrtc/signaling/src/sdp/SdpMediaSection.h b/media/webrtc/signaling/src/sdp/SdpMediaSection.h index dde6a5d421728..3ead706cbe79f 100644 --- a/media/webrtc/signaling/src/sdp/SdpMediaSection.h +++ b/media/webrtc/signaling/src/sdp/SdpMediaSection.h @@ -74,7 +74,7 @@ class SdpMediaSection virtual unsigned int GetPortCount() const = 0; virtual Protocol GetProtocol() const = 0; virtual const SdpConnection& GetConnection() const = 0; - virtual const Maybe& GetBandwidth(const std::string& type) const = 0; + virtual const std::string& GetBandwidth(const std::string& type) const = 0; virtual const std::vector& GetFormats() const = 0; virtual const SdpAttributeList &GetAttributeList() const = 0; diff --git a/media/webrtc/signaling/src/sdp/SipccSdp.cpp b/media/webrtc/signaling/src/sdp/SipccSdp.cpp index f1c468dff67c6..12d2087c6ef70 100644 --- a/media/webrtc/signaling/src/sdp/SipccSdp.cpp +++ b/media/webrtc/signaling/src/sdp/SipccSdp.cpp @@ -14,12 +14,18 @@ SipccSdp::~SipccSdp() { } } -const Maybe& +const SdpOrigin& SipccSdp::GetOrigin() const { + return *mOrigin; +} + +const std::string& SipccSdp::GetBandwidth(const std::string& type) const { - if (mBandwidths.count(type) > 0) { - return Nothing(); + static std::string emptyString(""); + auto found = mBandwidths.find(type); + if (found == mBandwidths.end()) { + return emptyString; } - return Some(mBandwidths[type]); + return found->second; } const SdpMediaSection& diff --git a/media/webrtc/signaling/src/sdp/SipccSdp.h b/media/webrtc/signaling/src/sdp/SipccSdp.h index a1ed3590a7374..e06076cca9bf2 100644 --- a/media/webrtc/signaling/src/sdp/SipccSdp.h +++ b/media/webrtc/signaling/src/sdp/SipccSdp.h @@ -29,16 +29,13 @@ class SipccSdp MOZ_FINAL : public Sdp public: ~SipccSdp(); - virtual const SdpOrigin& GetOrigin() const MOZ_OVERRIDE { - return *mOrigin; - } + virtual const SdpOrigin& GetOrigin() const MOZ_OVERRIDE; virtual const std::string& GetSessionName() const MOZ_OVERRIDE { return mSessionName; } // Note: connection information is always retrieved from media sections - virtual const Maybe& GetBandwidth( - const std::string& type) const MOZ_OVERRIDE; + virtual const std::string& GetBandwidth(const std::string& type) const MOZ_OVERRIDE; virtual uint16_t GetMediaSectionCount() const MOZ_OVERRIDE { return static_cast(mMediaSections.size()); diff --git a/media/webrtc/signaling/src/sdp/SipccSdpMediaSection.cpp b/media/webrtc/signaling/src/sdp/SipccSdpMediaSection.cpp index 94d4f655b4671..a1428ea783783 100644 --- a/media/webrtc/signaling/src/sdp/SipccSdpMediaSection.cpp +++ b/media/webrtc/signaling/src/sdp/SipccSdpMediaSection.cpp @@ -28,9 +28,14 @@ SipccSdpMediaSection::GetConnection() const { return SdpConnection(sdp::kInternet, sdp::kIPv4, "0.0.0.0"); } -const Maybe& +const std::string& SipccSdpMediaSection::GetBandwidth(const std::string& type) const { - return Maybe(); + static std::string emptyString(""); + auto found = mBandwidths.find(type); + if (found == mBandwidths.end()) { + return emptyString; + } + return found->second; } const std::vector& diff --git a/media/webrtc/signaling/src/sdp/SipccSdpMediaSection.h b/media/webrtc/signaling/src/sdp/SipccSdpMediaSection.h index 0ada8eb2689cb..1121293e61238 100644 --- a/media/webrtc/signaling/src/sdp/SipccSdpMediaSection.h +++ b/media/webrtc/signaling/src/sdp/SipccSdpMediaSection.h @@ -37,7 +37,7 @@ class SipccSdpMediaSection MOZ_FINAL : public SdpMediaSection virtual unsigned int GetPortCount() const MOZ_OVERRIDE; virtual Protocol GetProtocol() const MOZ_OVERRIDE; virtual const SdpConnection& GetConnection() const MOZ_OVERRIDE; - virtual const Maybe& GetBandwidth(const std::string& type) const MOZ_OVERRIDE; + virtual const std::string& GetBandwidth(const std::string& type) const MOZ_OVERRIDE; virtual const std::vector& GetFormats() const MOZ_OVERRIDE; virtual const SdpAttributeList &GetAttributeList() const MOZ_OVERRIDE; @@ -58,6 +58,7 @@ class SipccSdpMediaSection MOZ_FINAL : public SdpMediaSection SipccSdpAttributeList mAttributes; UniquePtr mConnection; + std::map mBandwidths; SipccSdpAttributeList mAttributeList; };