mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out 2 changesets (bug 1251714, bug 1251715) for gtest failures in media code a=backout
Backed out changeset 1bbd0cd10f76 (bug 1251714) Backed out changeset 80b197c5608f (bug 1251715) MozReview-Commit-ID: EHOtiKLS4Xr
This commit is contained in:
parent
48cce72dbb
commit
fe16a1ee67
@ -1103,7 +1103,7 @@ static auto& MediaManager_AnonymizeDevices = MediaManager::AnonymizeDevices;
|
||||
already_AddRefed<MediaManager::PledgeChar>
|
||||
MediaManager::SelectSettings(
|
||||
MediaStreamConstraints& aConstraints,
|
||||
RefPtr<Refcountable<UniquePtr<SourceSet>>>& aSources)
|
||||
RefPtr<Refcountable<ScopedDeletePtr<SourceSet>>>& aSources)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
RefPtr<PledgeChar> p = new PledgeChar();
|
||||
@ -1414,7 +1414,7 @@ MediaManager::EnumerateRawDevices(uint64_t aWindowId,
|
||||
realBackend = manager->GetBackend(aWindowId);
|
||||
}
|
||||
|
||||
auto result = MakeUnique<SourceSet>();
|
||||
ScopedDeletePtr<SourceSet> result(new SourceSet);
|
||||
|
||||
if (hasVideo) {
|
||||
nsTArray<RefPtr<VideoDevice>> videos;
|
||||
@ -1432,16 +1432,16 @@ MediaManager::EnumerateRawDevices(uint64_t aWindowId,
|
||||
result->AppendElement(source);
|
||||
}
|
||||
}
|
||||
SourceSet* handoff = result.release();
|
||||
SourceSet* handoff = result.forget();
|
||||
NS_DispatchToMainThread(do_AddRef(NewRunnableFrom([id, handoff]() mutable {
|
||||
UniquePtr<SourceSet> result(handoff); // grab result
|
||||
ScopedDeletePtr<SourceSet> result(handoff); // grab result
|
||||
RefPtr<MediaManager> mgr = MediaManager_GetInstance();
|
||||
if (!mgr) {
|
||||
return NS_OK;
|
||||
}
|
||||
RefPtr<PledgeSourceSet> p = mgr->mOutstandingPledges.Remove(id);
|
||||
if (p) {
|
||||
p->Resolve(result.release());
|
||||
p->Resolve(result.forget());
|
||||
}
|
||||
return NS_OK;
|
||||
})));
|
||||
@ -1609,9 +1609,9 @@ media::Parent<media::NonE10s>*
|
||||
MediaManager::GetNonE10sParent()
|
||||
{
|
||||
if (!mNonE10sParent) {
|
||||
mNonE10sParent = MakeUnique<media::Parent<media::NonE10s>>(true);
|
||||
mNonE10sParent = new media::Parent<media::NonE10s>(true);
|
||||
}
|
||||
return mNonE10sParent.get();
|
||||
return mNonE10sParent;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
@ -2115,8 +2115,8 @@ MediaManager::GetUserMedia(nsPIDOMWindowInner* aWindow,
|
||||
p->Then([this, onSuccess, onFailure, windowID, c, listener, askPermission,
|
||||
prefs, isHTTPS, callID, origin](SourceSet*& aDevices) mutable {
|
||||
|
||||
RefPtr<Refcountable<UniquePtr<SourceSet>>> devices(
|
||||
new Refcountable<UniquePtr<SourceSet>>(aDevices)); // grab result
|
||||
RefPtr<Refcountable<ScopedDeletePtr<SourceSet>>> devices(
|
||||
new Refcountable<ScopedDeletePtr<SourceSet>>(aDevices)); // grab result
|
||||
|
||||
// Ensure that the captured 'this' pointer and our windowID are still good.
|
||||
if (!MediaManager::Exists() ||
|
||||
@ -2176,7 +2176,7 @@ MediaManager::GetUserMedia(nsPIDOMWindowInner* aWindow,
|
||||
onFailure.forget(),
|
||||
windowID, listener,
|
||||
prefs, origin,
|
||||
devices->release()));
|
||||
devices->forget()));
|
||||
// Store the task w/callbacks.
|
||||
mActiveCallbacks.Put(callID, task.forget());
|
||||
|
||||
@ -2335,7 +2335,7 @@ MediaManager::EnumerateDevicesImpl(uint64_t aWindowId,
|
||||
aVideoType, aAudioType,
|
||||
aFake, aFakeTracks);
|
||||
p->Then([id, aWindowId, aOriginKey](SourceSet*& aDevices) mutable {
|
||||
UniquePtr<SourceSet> devices(aDevices); // secondary result
|
||||
ScopedDeletePtr<SourceSet> devices(aDevices); // secondary result
|
||||
|
||||
// Only run if window is still on our active list.
|
||||
RefPtr<MediaManager> mgr = MediaManager_GetInstance();
|
||||
@ -2347,7 +2347,7 @@ MediaManager::EnumerateDevicesImpl(uint64_t aWindowId,
|
||||
return NS_OK;
|
||||
}
|
||||
MediaManager_AnonymizeDevices(*devices, aOriginKey);
|
||||
p->Resolve(devices.release());
|
||||
p->Resolve(devices.forget());
|
||||
return NS_OK;
|
||||
});
|
||||
});
|
||||
@ -2381,7 +2381,7 @@ MediaManager::EnumerateDevices(nsPIDOMWindowInner* aWindow,
|
||||
MediaSourceEnum::Microphone,
|
||||
fake);
|
||||
p->Then([onSuccess, windowId, listener](SourceSet*& aDevices) mutable {
|
||||
UniquePtr<SourceSet> devices(aDevices); // grab result
|
||||
ScopedDeletePtr<SourceSet> devices(aDevices); // grab result
|
||||
RefPtr<MediaManager> mgr = MediaManager_GetInstance();
|
||||
mgr->RemoveFromWindowList(windowId, listener);
|
||||
nsCOMPtr<nsIWritableVariant> array = MediaManager_ToJSArray(*devices);
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include "mozilla/media/MediaChild.h"
|
||||
#include "mozilla/media/MediaParent.h"
|
||||
#include "mozilla/Logging.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "DOMMediaStream.h"
|
||||
|
||||
#ifdef MOZ_WEBRTC
|
||||
@ -502,7 +501,7 @@ private:
|
||||
already_AddRefed<PledgeChar>
|
||||
SelectSettings(
|
||||
dom::MediaStreamConstraints& aConstraints,
|
||||
RefPtr<media::Refcountable<UniquePtr<SourceSet>>>& aSources);
|
||||
RefPtr<media::Refcountable<ScopedDeletePtr<SourceSet>>>& aSources);
|
||||
|
||||
StreamListeners* AddWindowID(uint64_t aWindowId);
|
||||
WindowTable *GetActiveWindows() {
|
||||
@ -551,7 +550,7 @@ private:
|
||||
#endif
|
||||
public:
|
||||
media::CoatCheck<media::Pledge<nsCString>> mGetOriginKeyPledges;
|
||||
UniquePtr<media::Parent<media::NonE10s>> mNonE10sParent;
|
||||
ScopedDeletePtr<media::Parent<media::NonE10s>> mNonE10sParent;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "gfx2DGlue.h"
|
||||
#include "ImageContainer.h"
|
||||
#include "Layers.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -53,18 +52,18 @@ VideoFrame::CreateBlackImage(const gfx::IntSize& aSize)
|
||||
int len = ((aSize.width * aSize.height) * 3 / 2);
|
||||
|
||||
// Generate a black image.
|
||||
auto frame = MakeUnique<uint8_t[]>(len);
|
||||
ScopedDeletePtr<uint8_t> frame(new uint8_t[len]);
|
||||
int y = aSize.width * aSize.height;
|
||||
// Fill Y plane.
|
||||
memset(frame.get(), 0x10, y);
|
||||
memset(frame.rwget(), 0x10, y);
|
||||
// Fill Cb/Cr planes.
|
||||
memset(frame.get() + y, 0x80, (len - y));
|
||||
memset(frame.rwget() + y, 0x80, (len - y));
|
||||
|
||||
const uint8_t lumaBpp = 8;
|
||||
const uint8_t chromaBpp = 4;
|
||||
|
||||
layers::PlanarYCbCrData data;
|
||||
data.mYChannel = frame.get();
|
||||
data.mYChannel = frame.rwget();
|
||||
data.mYSize = gfx::IntSize(aSize.width, aSize.height);
|
||||
data.mYStride = (int32_t) (aSize.width * lumaBpp / 8.0);
|
||||
data.mCbCrStride = (int32_t) (aSize.width * chromaBpp / 8.0);
|
||||
|
@ -46,7 +46,7 @@ SanitizeOriginKeys(const uint64_t& aSinceWhen, bool aOnlyPrivateBrowsing)
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||
// Avoid opening MediaManager in this case, since this is called by
|
||||
// sanitize.js when cookies are cleared, which can happen on startup.
|
||||
auto tmpParent = MakeUnique<Parent<NonE10s>>(true);
|
||||
ScopedDeletePtr<Parent<NonE10s>> tmpParent(new Parent<NonE10s>(true));
|
||||
tmpParent->RecvSanitizeOriginKeys(aSinceWhen, aOnlyPrivateBrowsing);
|
||||
} else {
|
||||
Child::Get()->SendSanitizeOriginKeys(aSinceWhen, aOnlyPrivateBrowsing);
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsIAsyncShutdown.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "base/task.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -97,7 +96,7 @@ public:
|
||||
OnSuccessType mOnSuccess;
|
||||
OnFailureType mOnFailure;
|
||||
};
|
||||
mFunctors = MakeUnique<Functors>(Forward<OnSuccessType>(aOnSuccess),
|
||||
mFunctors = new Functors(Forward<OnSuccessType>(aOnSuccess),
|
||||
Forward<OnFailureType>(aOnFailure));
|
||||
if (mDone) {
|
||||
if (!mRejected) {
|
||||
@ -143,7 +142,7 @@ private:
|
||||
bool mDone;
|
||||
bool mRejected;
|
||||
ErrorType mError;
|
||||
UniquePtr<FunctorsBase> mFunctors;
|
||||
ScopedDeletePtr<FunctorsBase> mFunctors;
|
||||
};
|
||||
|
||||
/* media::NewRunnableFrom() - Create an nsRunnable from a lambda.
|
||||
@ -338,7 +337,7 @@ private:
|
||||
* (or owning smart-pointers to such objects) refcountable.
|
||||
*
|
||||
* Technical limitation: A template specialization is needed for types that take
|
||||
* a constructor. Please add below (UniquePtr covers a lot of ground though).
|
||||
* a constructor. Please add below (ScopedDeletePtr covers a lot of ground though).
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
@ -351,13 +350,13 @@ private:
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class Refcountable<UniquePtr<T>> : public UniquePtr<T>
|
||||
class Refcountable<ScopedDeletePtr<T>> : public ScopedDeletePtr<T>
|
||||
{
|
||||
public:
|
||||
explicit Refcountable<UniquePtr<T>>(T* aPtr) : UniquePtr<T>(aPtr) {}
|
||||
explicit Refcountable<ScopedDeletePtr<T>>(T* aPtr) : ScopedDeletePtr<T>(aPtr) {}
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(Refcountable<T>)
|
||||
private:
|
||||
~Refcountable<UniquePtr<T>>() {}
|
||||
~Refcountable<ScopedDeletePtr<T>>() {}
|
||||
};
|
||||
|
||||
/* media::ShutdownBlocker - Async shutdown helper.
|
||||
|
@ -58,8 +58,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "prnetdb.h"
|
||||
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/Scoped.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIEventTarget.h"
|
||||
#include "nsITimer.h"
|
||||
@ -99,15 +99,16 @@ class NrIceStunServer {
|
||||
}
|
||||
|
||||
// The main function to use. Will take either an address or a hostname.
|
||||
static UniquePtr<NrIceStunServer> Create(const std::string& addr, uint16_t port,
|
||||
static NrIceStunServer* Create(const std::string& addr, uint16_t port,
|
||||
const char *transport = kNrIceTransportUdp) {
|
||||
UniquePtr<NrIceStunServer> server(new NrIceStunServer(transport));
|
||||
ScopedDeletePtr<NrIceStunServer> server(
|
||||
new NrIceStunServer(transport));
|
||||
|
||||
nsresult rv = server->Init(addr, port);
|
||||
if (NS_FAILED(rv))
|
||||
return nullptr;
|
||||
|
||||
return server;
|
||||
return server.forget();
|
||||
}
|
||||
|
||||
nsresult ToNicerStunStruct(nr_ice_stun_server* server) const;
|
||||
@ -145,17 +146,18 @@ class NrIceStunServer {
|
||||
|
||||
class NrIceTurnServer : public NrIceStunServer {
|
||||
public:
|
||||
static UniquePtr<NrIceTurnServer> Create(const std::string& addr, uint16_t port,
|
||||
static NrIceTurnServer *Create(const std::string& addr, uint16_t port,
|
||||
const std::string& username,
|
||||
const std::vector<unsigned char>& password,
|
||||
const char *transport = kNrIceTransportUdp) {
|
||||
UniquePtr<NrIceTurnServer> server(new NrIceTurnServer(username, password, transport));
|
||||
ScopedDeletePtr<NrIceTurnServer> server(
|
||||
new NrIceTurnServer(username, password, transport));
|
||||
|
||||
nsresult rv = server->Init(addr, port);
|
||||
if (NS_FAILED(rv))
|
||||
return nullptr;
|
||||
|
||||
return server;
|
||||
return server.forget();
|
||||
}
|
||||
|
||||
nsresult ToNicerTurnStruct(nr_ice_turn_server *server) const;
|
||||
|
@ -46,6 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "logging.h"
|
||||
#include "nsError.h"
|
||||
#include "mozilla/Scoped.h"
|
||||
|
||||
// nICEr includes
|
||||
extern "C" {
|
||||
@ -168,13 +169,13 @@ static bool ToNrIceCandidate(const nr_ice_candidate& candc,
|
||||
// Make an NrIceCandidate from the candidate |cand|.
|
||||
// This is not a member fxn because we want to hide the
|
||||
// defn of nr_ice_candidate but we pass by reference.
|
||||
static UniquePtr<NrIceCandidate> MakeNrIceCandidate(const nr_ice_candidate& candc) {
|
||||
UniquePtr<NrIceCandidate> out(new NrIceCandidate());
|
||||
static NrIceCandidate* MakeNrIceCandidate(const nr_ice_candidate& candc) {
|
||||
ScopedDeletePtr<NrIceCandidate> out(new NrIceCandidate());
|
||||
|
||||
if (!ToNrIceCandidate(candc, out.get())) {
|
||||
if (!ToNrIceCandidate(candc, out)) {
|
||||
return nullptr;
|
||||
}
|
||||
return out;
|
||||
return out.forget();
|
||||
}
|
||||
|
||||
// NrIceMediaStream
|
||||
@ -258,8 +259,8 @@ nsresult NrIceMediaStream::ParseTrickleCandidate(const std::string& candidate) {
|
||||
|
||||
// Returns NS_ERROR_NOT_AVAILABLE if component is unpaired or disabled.
|
||||
nsresult NrIceMediaStream::GetActivePair(int component,
|
||||
UniquePtr<NrIceCandidate>* localp,
|
||||
UniquePtr<NrIceCandidate>* remotep) {
|
||||
NrIceCandidate **localp,
|
||||
NrIceCandidate **remotep) {
|
||||
int r;
|
||||
nr_ice_candidate *local_int;
|
||||
nr_ice_candidate *remote_int;
|
||||
@ -279,20 +280,20 @@ nsresult NrIceMediaStream::GetActivePair(int component,
|
||||
if (r)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
UniquePtr<NrIceCandidate> local(
|
||||
ScopedDeletePtr<NrIceCandidate> local(
|
||||
MakeNrIceCandidate(*local_int));
|
||||
if (!local)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
UniquePtr<NrIceCandidate> remote(
|
||||
ScopedDeletePtr<NrIceCandidate> remote(
|
||||
MakeNrIceCandidate(*remote_int));
|
||||
if (!remote)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (localp)
|
||||
*localp = Move(local);
|
||||
*localp = local.forget();
|
||||
if (remotep)
|
||||
*remotep = Move(remote);
|
||||
*remotep = remote.forget();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "sigslot.h"
|
||||
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/Scoped.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIEventTarget.h"
|
||||
#include "nsITimer.h"
|
||||
@ -159,8 +159,7 @@ class NrIceMediaStream {
|
||||
// Get the candidate pair currently active. It's the
|
||||
// caller's responsibility to free these.
|
||||
nsresult GetActivePair(int component,
|
||||
UniquePtr<NrIceCandidate>* local,
|
||||
UniquePtr<NrIceCandidate>* remote);
|
||||
NrIceCandidate** local, NrIceCandidate** remote);
|
||||
|
||||
// The number of components
|
||||
size_t components() const { return components_; }
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include "nss.h"
|
||||
#include "ssl.h"
|
||||
|
||||
#include "mozilla/Scoped.h"
|
||||
|
||||
extern "C" {
|
||||
#include "nr_api.h"
|
||||
#include "nr_socket.h"
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "ssl.h"
|
||||
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Scoped.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsXPCOM.h"
|
||||
|
||||
@ -470,7 +471,7 @@ class IceTestPeer : public sigslot::has_slots<> {
|
||||
}
|
||||
|
||||
std::vector<NrIceStunServer> stun_servers;
|
||||
UniquePtr<NrIceStunServer> server(NrIceStunServer::Create(
|
||||
ScopedDeletePtr<NrIceStunServer> server(NrIceStunServer::Create(
|
||||
addr, port, transport));
|
||||
stun_servers.push_back(*server);
|
||||
SetStunServers(stun_servers);
|
||||
@ -499,7 +500,7 @@ class IceTestPeer : public sigslot::has_slots<> {
|
||||
const std::vector<unsigned char> password,
|
||||
const char* transport) {
|
||||
std::vector<NrIceTurnServer> turn_servers;
|
||||
UniquePtr<NrIceTurnServer> server(NrIceTurnServer::Create(
|
||||
ScopedDeletePtr<NrIceTurnServer> server(NrIceTurnServer::Create(
|
||||
addr, port, username, password, transport));
|
||||
turn_servers.push_back(*server);
|
||||
ASSERT_TRUE(NS_SUCCEEDED(ice_ctx_->SetTurnServers(turn_servers)));
|
||||
@ -843,8 +844,8 @@ class IceTestPeer : public sigslot::has_slots<> {
|
||||
for (size_t j=0; j < streams_[i]->components(); ++j) {
|
||||
std::cerr << "Stream " << i << " component " << j+1 << std::endl;
|
||||
|
||||
UniquePtr<NrIceCandidate> local;
|
||||
UniquePtr<NrIceCandidate> remote;
|
||||
NrIceCandidate *local;
|
||||
NrIceCandidate *remote;
|
||||
|
||||
nsresult res = streams_[i]->GetActivePair(j+1, &local, &remote);
|
||||
if (res == NS_ERROR_NOT_AVAILABLE) {
|
||||
@ -875,6 +876,8 @@ class IceTestPeer : public sigslot::has_slots<> {
|
||||
if (!expected_remote_addr_.empty()) {
|
||||
ASSERT_EQ(expected_remote_addr_, remote->cand_addr.host);
|
||||
}
|
||||
delete local;
|
||||
delete remote;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1312,7 +1315,7 @@ class IceGatherTest : public StunTest {
|
||||
|
||||
void EnsurePeer(const unsigned int flags = ICE_TEST_PEER_OFFERER) {
|
||||
if (!peer_) {
|
||||
peer_ = MakeUnique<IceTestPeer>("P1", test_utils_,
|
||||
peer_ = new IceTestPeer("P1", test_utils_,
|
||||
flags & ICE_TEST_PEER_OFFERER,
|
||||
flags & ICE_TEST_PEER_ALLOW_LOOPBACK,
|
||||
flags & ICE_TEST_PEER_ENABLED_TCP,
|
||||
@ -1450,7 +1453,7 @@ class IceGatherTest : public StunTest {
|
||||
}
|
||||
|
||||
protected:
|
||||
mozilla::UniquePtr<IceTestPeer> peer_;
|
||||
mozilla::ScopedDeletePtr<IceTestPeer> peer_;
|
||||
};
|
||||
|
||||
class IceConnectTest : public StunTest {
|
||||
@ -1490,9 +1493,9 @@ class IceConnectTest : public StunTest {
|
||||
|
||||
void Init(bool allow_loopback, bool enable_tcp, bool default_only = false) {
|
||||
if (!initted_) {
|
||||
p1_ = MakeUnique<IceTestPeer>("P1", test_utils_, true, allow_loopback,
|
||||
p1_ = new IceTestPeer("P1", test_utils_, true, allow_loopback,
|
||||
enable_tcp, false, default_only);
|
||||
p2_ = MakeUnique<IceTestPeer>("P2", test_utils_, false, allow_loopback,
|
||||
p2_ = new IceTestPeer("P2", test_utils_, false, allow_loopback,
|
||||
enable_tcp, false, default_only);
|
||||
}
|
||||
initted_ = true;
|
||||
@ -1590,8 +1593,8 @@ class IceConnectTest : public StunTest {
|
||||
// to |this|, meaning that p2_->Connect(p1_, ...) simulates p1 sending an
|
||||
// offer to p2. Order matters here because it determines which peer is
|
||||
// controlling.
|
||||
p2_->Connect(p1_.get(), TRICKLE_NONE);
|
||||
p1_->Connect(p2_.get(), TRICKLE_NONE);
|
||||
p2_->Connect(p1_, TRICKLE_NONE);
|
||||
p1_->Connect(p2_, TRICKLE_NONE);
|
||||
|
||||
ASSERT_TRUE_WAIT(p1_->ready_ct() == 1 && p2_->ready_ct() == 1,
|
||||
kDefaultTimeout);
|
||||
@ -1621,11 +1624,11 @@ class IceConnectTest : public StunTest {
|
||||
}
|
||||
|
||||
void ConnectP1(TrickleMode mode = TRICKLE_NONE) {
|
||||
p1_->Connect(p2_.get(), mode);
|
||||
p1_->Connect(p2_, mode);
|
||||
}
|
||||
|
||||
void ConnectP2(TrickleMode mode = TRICKLE_NONE) {
|
||||
p2_->Connect(p1_.get(), mode);
|
||||
p2_->Connect(p1_, mode);
|
||||
}
|
||||
|
||||
void WaitForComplete(int expected_streams = 1) {
|
||||
@ -1646,8 +1649,8 @@ class IceConnectTest : public StunTest {
|
||||
}
|
||||
|
||||
void ConnectTrickle(TrickleMode trickle = TRICKLE_SIMULATE) {
|
||||
p2_->Connect(p1_.get(), trickle);
|
||||
p1_->Connect(p2_.get(), trickle);
|
||||
p2_->Connect(p1_, trickle);
|
||||
p1_->Connect(p2_, trickle);
|
||||
}
|
||||
|
||||
void SimulateTrickle(size_t stream) {
|
||||
@ -1673,8 +1676,8 @@ class IceConnectTest : public StunTest {
|
||||
}
|
||||
|
||||
void ConnectThenDelete() {
|
||||
p2_->Connect(p1_.get(), TRICKLE_NONE, false);
|
||||
p1_->Connect(p2_.get(), TRICKLE_NONE, true);
|
||||
p2_->Connect(p1_, TRICKLE_NONE, false);
|
||||
p1_->Connect(p2_, TRICKLE_NONE, true);
|
||||
test_utils_->sts_target()->Dispatch(WrapRunnable(this,
|
||||
&IceConnectTest::CloseP1),
|
||||
NS_DISPATCH_SYNC);
|
||||
@ -1698,8 +1701,8 @@ class IceConnectTest : public StunTest {
|
||||
protected:
|
||||
bool initted_;
|
||||
nsCOMPtr<nsIEventTarget> target_;
|
||||
mozilla::UniquePtr<IceTestPeer> p1_;
|
||||
mozilla::UniquePtr<IceTestPeer> p2_;
|
||||
mozilla::ScopedDeletePtr<IceTestPeer> p1_;
|
||||
mozilla::ScopedDeletePtr<IceTestPeer> p2_;
|
||||
bool use_nat_;
|
||||
TestNat::NatBehavior filtering_type_;
|
||||
TestNat::NatBehavior mapping_type_;
|
||||
@ -1857,7 +1860,7 @@ TEST_F(IceGatherTest, TestGatherStunServerIpAddressDefaultRouteOnly) {
|
||||
return;
|
||||
}
|
||||
|
||||
peer_ = MakeUnique<IceTestPeer>("P1", test_utils_, true, false, false, false, true);
|
||||
peer_ = new IceTestPeer("P1", test_utils_, true, false, false, false, true);
|
||||
peer_->AddStream(1);
|
||||
peer_->SetStunServer(stun_server_address_, kDefaultStunServerPort);
|
||||
peer_->SetFakeResolver(stun_server_address_, stun_server_hostname_);
|
||||
@ -2046,7 +2049,7 @@ TEST_F(IceGatherTest, TestGatherVerifyNoLoopback) {
|
||||
|
||||
TEST_F(IceGatherTest, TestGatherAllowLoopback) {
|
||||
// Set up peer with loopback allowed.
|
||||
peer_ = MakeUnique<IceTestPeer>("P1", test_utils_, true, true);
|
||||
peer_ = new IceTestPeer("P1", test_utils_, true, true);
|
||||
peer_->AddStream(1);
|
||||
Gather();
|
||||
ASSERT_TRUE(StreamHasMatchingCandidate(0, "127.0.0.1"));
|
||||
@ -2054,7 +2057,7 @@ TEST_F(IceGatherTest, TestGatherAllowLoopback) {
|
||||
|
||||
TEST_F(IceGatherTest, TestGatherTcpDisabled) {
|
||||
// Set up peer with tcp disabled.
|
||||
peer_ = MakeUnique<IceTestPeer>("P1", test_utils_, true, false, false);
|
||||
peer_ = new IceTestPeer("P1", test_utils_, true, false, false);
|
||||
peer_->AddStream(1);
|
||||
Gather();
|
||||
ASSERT_FALSE(StreamHasMatchingCandidate(0, " TCP "));
|
||||
@ -2157,7 +2160,7 @@ TEST_F(IceGatherTest, TestStunServerTrickle) {
|
||||
// Test default route only with our fake STUN server and
|
||||
// apparently NATted.
|
||||
TEST_F(IceGatherTest, TestFakeStunServerNatedDefaultRouteOnly) {
|
||||
peer_ = MakeUnique<IceTestPeer>("P1", test_utils_, true, false, false, false, true);
|
||||
peer_ = new IceTestPeer("P1", test_utils_, true, false, false, false, true);
|
||||
peer_->AddStream(1);
|
||||
UseFakeStunUdpServerWithResponse("192.0.2.1", 3333);
|
||||
Gather(0);
|
||||
@ -2175,7 +2178,7 @@ TEST_F(IceGatherTest, TestFakeStunServerNatedDefaultRouteOnly) {
|
||||
// Test default route only with our fake STUN server and
|
||||
// apparently non-NATted.
|
||||
TEST_F(IceGatherTest, TestFakeStunServerNoNatDefaultRouteOnly) {
|
||||
peer_ = MakeUnique<IceTestPeer>("P1", test_utils_, true, false, false, false, true);
|
||||
peer_ = new IceTestPeer("P1", test_utils_, true, false, false, false, true);
|
||||
peer_->AddStream(1);
|
||||
UseTestStunServer();
|
||||
Gather(0);
|
||||
@ -3054,8 +3057,10 @@ TEST_F(IceConnectTest, TestHostCandPairingFilter) {
|
||||
}
|
||||
|
||||
ConnectTrickle();
|
||||
AddNonPairableCandidates(p1_->ControlTrickle(0), p1_.get(), 0, host_net, test_utils_);
|
||||
AddNonPairableCandidates(p2_->ControlTrickle(0), p2_.get(), 0, host_net, test_utils_);
|
||||
AddNonPairableCandidates(p1_->ControlTrickle(0), p1_, 0, host_net,
|
||||
test_utils_);
|
||||
AddNonPairableCandidates(p2_->ControlTrickle(0), p2_, 0, host_net,
|
||||
test_utils_);
|
||||
|
||||
std::vector<NrIceCandidatePair> pairs;
|
||||
p1_->GetCandidatePairs(0, &pairs);
|
||||
@ -3116,8 +3121,8 @@ TEST_F(IceConnectTest, TestPollCandPairsDuringConnect) {
|
||||
AddStream("first", 1);
|
||||
ASSERT_TRUE(Gather());
|
||||
|
||||
p2_->Connect(p1_.get(), TRICKLE_NONE, false);
|
||||
p1_->Connect(p2_.get(), TRICKLE_NONE, false);
|
||||
p2_->Connect(p1_, TRICKLE_NONE, false);
|
||||
p1_->Connect(p2_, TRICKLE_NONE, false);
|
||||
|
||||
std::vector<NrIceCandidatePair> pairs1;
|
||||
std::vector<NrIceCandidatePair> pairs2;
|
||||
@ -3141,8 +3146,8 @@ TEST_F(IceConnectTest, TestRLogRingBuffer) {
|
||||
AddStream("first", 1);
|
||||
ASSERT_TRUE(Gather());
|
||||
|
||||
p2_->Connect(p1_.get(), TRICKLE_NONE, false);
|
||||
p1_->Connect(p2_.get(), TRICKLE_NONE, false);
|
||||
p2_->Connect(p1_, TRICKLE_NONE, false);
|
||||
p1_->Connect(p2_, TRICKLE_NONE, false);
|
||||
|
||||
std::vector<NrIceCandidatePair> pairs1;
|
||||
std::vector<NrIceCandidatePair> pairs2;
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#include "mozilla/Scoped.h"
|
||||
#include "mozilla/Atomics.h"
|
||||
#include "runnable_utils.h"
|
||||
#include "nss.h"
|
||||
@ -105,7 +106,7 @@ class MultiTcpSocketTest : public MtransportTest {
|
||||
|
||||
if (!stun_server_addr.empty()) {
|
||||
std::vector<NrIceStunServer> stun_servers;
|
||||
UniquePtr<NrIceStunServer> server(NrIceStunServer::Create(
|
||||
ScopedDeletePtr<NrIceStunServer> server(NrIceStunServer::Create(
|
||||
stun_server_addr, stun_server_port, kNrIceTransportTcp));
|
||||
stun_servers.push_back(*server);
|
||||
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include "nss.h"
|
||||
#include "ssl.h"
|
||||
|
||||
#include "mozilla/Scoped.h"
|
||||
|
||||
extern "C" {
|
||||
#include "nr_api.h"
|
||||
#include "nr_socket.h"
|
||||
|
@ -78,8 +78,7 @@ nrappkit copyright:
|
||||
ekr@rtfm.com Thu Dec 20 20:14:49 2001
|
||||
*/
|
||||
#include "logging.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "mozilla/Scoped.h"
|
||||
#include "databuffer.h"
|
||||
|
||||
extern "C" {
|
||||
@ -175,7 +174,7 @@ static nr_socket_vtbl nr_socket_wrapped_vtbl = {
|
||||
};
|
||||
|
||||
int nr_socket_wrapped_create(nr_socket *inner, nr_socket **outp) {
|
||||
auto wrapped = MakeUnique<nr_socket_wrapped>();
|
||||
ScopedDeletePtr<nr_socket_wrapped> wrapped(new nr_socket_wrapped());
|
||||
|
||||
wrapped->sock_ = inner;
|
||||
|
||||
@ -183,7 +182,7 @@ int nr_socket_wrapped_create(nr_socket *inner, nr_socket **outp) {
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
Unused << wrapped.release();
|
||||
wrapped.forget();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -191,10 +190,10 @@ int nr_socket_wrapped_create(nr_socket *inner, nr_socket **outp) {
|
||||
// Instance static.
|
||||
// Note: Calling Create() at static init time is not going to be safe, since
|
||||
// we have no reason to expect this will be initted to a nullptr yet.
|
||||
UniquePtr<TestStunServer> TestStunServer::instance;
|
||||
UniquePtr<TestStunTcpServer> TestStunTcpServer::instance;
|
||||
UniquePtr<TestStunServer> TestStunServer::instance6;
|
||||
UniquePtr<TestStunTcpServer> TestStunTcpServer::instance6;
|
||||
TestStunServer *TestStunServer::instance;
|
||||
TestStunTcpServer *TestStunTcpServer::instance;
|
||||
TestStunServer *TestStunServer::instance6;
|
||||
TestStunTcpServer *TestStunTcpServer::instance6;
|
||||
uint16_t TestStunServer::instance_port = 3478;
|
||||
uint16_t TestStunTcpServer::instance_port = 3478;
|
||||
|
||||
@ -324,10 +323,10 @@ int TestStunServer::Initialize(int address_family) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
UniquePtr<TestStunServer> TestStunServer::Create(int address_family) {
|
||||
TestStunServer* TestStunServer::Create(int address_family) {
|
||||
NR_reg_init(NR_REG_MODE_LOCAL);
|
||||
|
||||
UniquePtr<TestStunServer> server(new TestStunServer());
|
||||
ScopedDeletePtr<TestStunServer> server(new TestStunServer());
|
||||
|
||||
if (server->Initialize(address_family))
|
||||
return nullptr;
|
||||
@ -341,7 +340,7 @@ UniquePtr<TestStunServer> TestStunServer::Create(int address_family) {
|
||||
|
||||
NR_ASYNC_WAIT(fd, NR_ASYNC_WAIT_READ, &TestStunServer::readable_cb, server.get());
|
||||
|
||||
return server;
|
||||
return server.forget();
|
||||
}
|
||||
|
||||
void TestStunServer::ConfigurePort(uint16_t port) {
|
||||
@ -355,19 +354,21 @@ TestStunServer* TestStunServer::GetInstance(int address_family) {
|
||||
instance = Create(address_family);
|
||||
|
||||
MOZ_ASSERT(instance);
|
||||
return instance.get();
|
||||
return instance;
|
||||
case AF_INET6:
|
||||
if (!instance6)
|
||||
instance6 = Create(address_family);
|
||||
|
||||
return instance6.get();
|
||||
return instance6;
|
||||
default:
|
||||
MOZ_CRASH();
|
||||
}
|
||||
}
|
||||
|
||||
void TestStunServer::ShutdownInstance() {
|
||||
delete instance;
|
||||
instance = nullptr;
|
||||
delete instance6;
|
||||
instance6 = nullptr;
|
||||
}
|
||||
|
||||
@ -536,19 +537,21 @@ TestStunTcpServer* TestStunTcpServer::GetInstance(int address_family) {
|
||||
instance = Create(address_family);
|
||||
|
||||
MOZ_ASSERT(instance);
|
||||
return instance.get();
|
||||
return instance;
|
||||
case AF_INET6:
|
||||
if (!instance6)
|
||||
instance6 = Create(address_family);
|
||||
|
||||
return instance6.get();
|
||||
return instance6;
|
||||
default:
|
||||
MOZ_CRASH();
|
||||
}
|
||||
}
|
||||
|
||||
void TestStunTcpServer::ShutdownInstance() {
|
||||
delete instance;
|
||||
instance = nullptr;
|
||||
delete instance6;
|
||||
instance6 = nullptr;
|
||||
}
|
||||
|
||||
@ -628,10 +631,10 @@ void TestStunTcpServer::accept_cb(NR_SOCKET s, int how, void *cb_arg) {
|
||||
NR_ASYNC_WAIT(fd, NR_ASYNC_WAIT_READ, &TestStunServer::readable_cb, server);
|
||||
}
|
||||
|
||||
UniquePtr<TestStunTcpServer> TestStunTcpServer::Create(int address_family) {
|
||||
TestStunTcpServer* TestStunTcpServer::Create(int address_family) {
|
||||
NR_reg_init(NR_REG_MODE_LOCAL);
|
||||
|
||||
UniquePtr<TestStunTcpServer> server(new TestStunTcpServer());
|
||||
ScopedDeletePtr<TestStunTcpServer> server(new TestStunTcpServer());
|
||||
|
||||
if (server->Initialize(address_family)) {
|
||||
return nullptr;
|
||||
@ -645,7 +648,7 @@ void TestStunTcpServer::accept_cb(NR_SOCKET s, int how, void *cb_arg) {
|
||||
|
||||
NR_ASYNC_WAIT(fd, NR_ASYNC_WAIT_READ, &TestStunTcpServer::accept_cb, server.get());
|
||||
|
||||
return server;
|
||||
return server.forget();
|
||||
}
|
||||
|
||||
TestStunTcpServer::~TestStunTcpServer() {
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include <string>
|
||||
#include "prio.h"
|
||||
#include "nsError.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
typedef struct nr_stun_server_ctx_ nr_stun_server_ctx;
|
||||
typedef struct nr_socket_ nr_socket;
|
||||
@ -32,7 +31,7 @@ class TestStunServer {
|
||||
// to |GetInstance| (possibly following a |ShutdownInstance| call)
|
||||
static void ConfigurePort(uint16_t port);
|
||||
// AF_INET, AF_INET6
|
||||
static UniquePtr<TestStunServer> Create(int address_family);
|
||||
static TestStunServer *Create(int address_family);
|
||||
|
||||
virtual ~TestStunServer();
|
||||
|
||||
@ -90,8 +89,8 @@ class TestStunServer {
|
||||
void *timer_handle_;
|
||||
std::map<std::string, uint32_t> received_ct_;
|
||||
|
||||
static UniquePtr<TestStunServer> instance;
|
||||
static UniquePtr<TestStunServer> instance6;
|
||||
static TestStunServer *instance;
|
||||
static TestStunServer *instance6;
|
||||
static uint16_t instance_port;
|
||||
};
|
||||
|
||||
@ -111,10 +110,10 @@ class TestStunTcpServer: public TestStunServer {
|
||||
|
||||
private:
|
||||
virtual int TryOpenListenSocket(nr_local_addr *addr, uint16_t port);
|
||||
static UniquePtr<TestStunTcpServer> Create(int address_family);
|
||||
static TestStunTcpServer *Create(int address_family);
|
||||
|
||||
static UniquePtr<TestStunTcpServer> instance;
|
||||
static UniquePtr<TestStunTcpServer> instance6;
|
||||
static TestStunTcpServer *instance;
|
||||
static TestStunTcpServer *instance6;
|
||||
static uint16_t instance_port;
|
||||
|
||||
std::map<NR_SOCKET, nr_socket*> connections_;
|
||||
|
@ -49,6 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "nss.h"
|
||||
#include "ssl.h"
|
||||
|
||||
#include "mozilla/Scoped.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsXPCOM.h"
|
||||
|
||||
|
@ -35,14 +35,14 @@ TransportFlow::~TransportFlow() {
|
||||
// destroy it simultaneously. The conversion to an nsAutoPtr
|
||||
// ensures automatic destruction of the queue at exit of
|
||||
// DestroyFinal.
|
||||
nsAutoPtr<std::deque<TransportLayer*>> layers_tmp(layers_.release());
|
||||
nsAutoPtr<std::deque<TransportLayer*> > layers_tmp(layers_.forget());
|
||||
RUN_ON_THREAD(target_,
|
||||
WrapRunnableNM(&TransportFlow::DestroyFinal, layers_tmp),
|
||||
NS_DISPATCH_NORMAL);
|
||||
}
|
||||
|
||||
void TransportFlow::DestroyFinal(nsAutoPtr<std::deque<TransportLayer *> > layers) {
|
||||
ClearLayers(layers.get());
|
||||
ClearLayers(layers);
|
||||
}
|
||||
|
||||
void TransportFlow::ClearLayers(std::queue<TransportLayer *>* layers) {
|
||||
@ -61,7 +61,7 @@ void TransportFlow::ClearLayers(std::deque<TransportLayer *>* layers) {
|
||||
|
||||
nsresult TransportFlow::PushLayer(TransportLayer *layer) {
|
||||
CheckThread();
|
||||
UniquePtr<TransportLayer> layer_tmp(layer); // Destroy on failure.
|
||||
ScopedDeletePtr<TransportLayer> layer_tmp(layer); // Destroy on failure.
|
||||
|
||||
// Don't allow pushes once we are in error state.
|
||||
if (state_ == TransportLayer::TS_ERROR) {
|
||||
@ -90,7 +90,7 @@ nsresult TransportFlow::PushLayer(TransportLayer *layer) {
|
||||
old_layer->SignalStateChange.disconnect(this);
|
||||
old_layer->SignalPacketReceived.disconnect(this);
|
||||
}
|
||||
layers_->push_front(layer_tmp.release());
|
||||
layers_->push_front(layer_tmp.forget());
|
||||
layer->Inserted(this, old_layer);
|
||||
|
||||
layer->SignalStateChange.connect(this, &TransportFlow::StateChange);
|
||||
@ -146,11 +146,11 @@ nsresult TransportFlow::PushLayers(nsAutoPtr<std::queue<TransportLayer *> > laye
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
// Destroy any layers we could not push.
|
||||
ClearLayers(layers.get());
|
||||
ClearLayers(layers);
|
||||
|
||||
// Now destroy the rest of the flow, because it's no longer
|
||||
// in an acceptable state.
|
||||
ClearLayers(layers_.get());
|
||||
ClearLayers(layers_);
|
||||
|
||||
// Set ourselves to have failed.
|
||||
StateChangeInt(TransportLayer::TS_ERROR);
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/Scoped.h"
|
||||
#include "transportlayer.h"
|
||||
#include "m_cpp_utils.h"
|
||||
#include "nsAutoPtr.h"
|
||||
@ -135,7 +135,7 @@ class TransportFlow final : public nsISupports,
|
||||
|
||||
std::string id_;
|
||||
TransportLayer::State state_;
|
||||
UniquePtr<std::deque<TransportLayer *>> layers_;
|
||||
ScopedDeletePtr<std::deque<TransportLayer *> > layers_;
|
||||
nsCOMPtr<nsIEventTarget> target_;
|
||||
};
|
||||
|
||||
|
@ -463,7 +463,7 @@ bool TransportLayerDtls::Setup() {
|
||||
MOZ_MTLOG(ML_ERROR, "DTLS layer with nothing below. This is useless");
|
||||
return false;
|
||||
}
|
||||
nspr_io_adapter_ = MakeUnique<TransportLayerNSPRAdapter>(downward_);
|
||||
nspr_io_adapter_ = new TransportLayerNSPRAdapter(downward_);
|
||||
|
||||
if (!identity_) {
|
||||
MOZ_MTLOG(ML_ERROR, "Can't start DTLS without an identity");
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "sigslot.h"
|
||||
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/Scoped.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIEventTarget.h"
|
||||
#include "nsITimer.h"
|
||||
@ -177,7 +177,7 @@ class TransportLayerDtls final : public TransportLayer {
|
||||
|
||||
// Must delete nspr_io_adapter after ssl_fd_ b/c ssl_fd_ causes an alert
|
||||
// (ssl_fd_ contains an un-owning pointer to nspr_io_adapter_)
|
||||
UniquePtr<TransportLayerNSPRAdapter> nspr_io_adapter_;
|
||||
ScopedDeletePtr<TransportLayerNSPRAdapter> nspr_io_adapter_;
|
||||
ScopedPRFileDesc ssl_fd_;
|
||||
|
||||
ScopedCERTCertificate peer_cert_;
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "sigslot.h"
|
||||
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/Scoped.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIEventTarget.h"
|
||||
#include "nsITimer.h"
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "mozilla/Move.h"
|
||||
#include "mozilla/Scoped.h"
|
||||
#include "mozilla/SyncRunnable.h"
|
||||
#include "VideoConduit.h"
|
||||
#include "AudioConduit.h"
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "MediaCodec.h"
|
||||
#include "WebrtcMediaCodecVP8VideoCodec.h"
|
||||
#include "AndroidJNIWrapper.h"
|
||||
#include "mozilla/Scoped.h"
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/Monitor.h"
|
||||
|
@ -513,10 +513,11 @@ void MediaPipeline::RtpPacketReceived(TransportLayer *layer,
|
||||
}
|
||||
|
||||
// Make a copy rather than cast away constness
|
||||
auto inner_data = MakeUnique<unsigned char[]>(len);
|
||||
memcpy(inner_data.get(), data, len);
|
||||
ScopedDeletePtr<unsigned char> inner_data(
|
||||
new unsigned char[len]);
|
||||
memcpy(inner_data, data, len);
|
||||
int out_len = 0;
|
||||
nsresult res = rtp_.recv_srtp_->UnprotectRtp(inner_data.get(),
|
||||
nsresult res = rtp_.recv_srtp_->UnprotectRtp(inner_data,
|
||||
len, len, &out_len);
|
||||
if (!NS_SUCCEEDED(res)) {
|
||||
char tmp[16];
|
||||
@ -535,7 +536,7 @@ void MediaPipeline::RtpPacketReceived(TransportLayer *layer,
|
||||
MOZ_MTLOG(ML_DEBUG, description_ << " received RTP packet.");
|
||||
increment_rtp_packets_received(out_len);
|
||||
|
||||
(void)conduit_->ReceivedRTPPacket(inner_data.get(), out_len); // Ignore error codes
|
||||
(void)conduit_->ReceivedRTPPacket(inner_data, out_len); // Ignore error codes
|
||||
}
|
||||
|
||||
void MediaPipeline::RtcpPacketReceived(TransportLayer *layer,
|
||||
@ -571,11 +572,12 @@ void MediaPipeline::RtcpPacketReceived(TransportLayer *layer,
|
||||
}
|
||||
|
||||
// Make a copy rather than cast away constness
|
||||
auto inner_data = MakeUnique<unsigned char[]>(len);
|
||||
memcpy(inner_data.get(), data, len);
|
||||
ScopedDeletePtr<unsigned char> inner_data(
|
||||
new unsigned char[len]);
|
||||
memcpy(inner_data, data, len);
|
||||
int out_len;
|
||||
|
||||
nsresult res = rtcp_.recv_srtp_->UnprotectRtcp(inner_data.get(),
|
||||
nsresult res = rtcp_.recv_srtp_->UnprotectRtcp(inner_data,
|
||||
len,
|
||||
len,
|
||||
&out_len);
|
||||
@ -586,7 +588,7 @@ void MediaPipeline::RtcpPacketReceived(TransportLayer *layer,
|
||||
// We do not filter RTCP for send pipelines, since the webrtc.org code for
|
||||
// senders already has logic to ignore RRs that do not apply.
|
||||
if (filter_ && direction_ == RECEIVE) {
|
||||
if (!filter_->FilterSenderReport(inner_data.get(), out_len)) {
|
||||
if (!filter_->FilterSenderReport(inner_data, out_len)) {
|
||||
MOZ_MTLOG(ML_NOTICE, "Dropping rtcp packet");
|
||||
return;
|
||||
}
|
||||
@ -597,7 +599,7 @@ void MediaPipeline::RtcpPacketReceived(TransportLayer *layer,
|
||||
|
||||
MOZ_ASSERT(rtcp_.recv_srtp_); // This should never happen
|
||||
|
||||
(void)conduit_->ReceivedRTCPPacket(inner_data.get(), out_len); // Ignore error codes
|
||||
(void)conduit_->ReceivedRTCPPacket(inner_data, out_len); // Ignore error codes
|
||||
}
|
||||
|
||||
bool MediaPipeline::IsRtp(const unsigned char *data, size_t len) {
|
||||
|
@ -125,10 +125,10 @@ JsepCodecDescToCodecConfig(const JsepCodecDescription& aCodec,
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
UniquePtr<VideoCodecConfigH264> h264Config;
|
||||
ScopedDeletePtr<VideoCodecConfigH264> h264Config;
|
||||
|
||||
if (desc.mName == "H264") {
|
||||
h264Config = MakeUnique<VideoCodecConfigH264>();
|
||||
h264Config = new VideoCodecConfigH264;
|
||||
size_t spropSize = sizeof(h264Config->sprop_parameter_sets);
|
||||
strncpy(h264Config->sprop_parameter_sets,
|
||||
desc.mSpropParameterSets.c_str(),
|
||||
@ -141,7 +141,7 @@ JsepCodecDescToCodecConfig(const JsepCodecDescription& aCodec,
|
||||
|
||||
VideoCodecConfig* configRaw;
|
||||
configRaw = new VideoCodecConfig(
|
||||
pt, desc.mName, desc.mConstraints, h264Config.get());
|
||||
pt, desc.mName, desc.mConstraints, h264Config);
|
||||
|
||||
configRaw->mAckFbTypes = desc.mAckFbTypes;
|
||||
configRaw->mNackFbTypes = desc.mNackFbTypes;
|
||||
|
@ -157,11 +157,12 @@ public:
|
||||
bool addStunServer(const std::string& addr, uint16_t port,
|
||||
const char* transport)
|
||||
{
|
||||
UniquePtr<NrIceStunServer> server(NrIceStunServer::Create(addr, port, transport));
|
||||
NrIceStunServer* server(NrIceStunServer::Create(addr, port, transport));
|
||||
if (!server) {
|
||||
return false;
|
||||
}
|
||||
addStunServer(*server);
|
||||
delete server;
|
||||
return true;
|
||||
}
|
||||
bool addTurnServer(const std::string& addr, uint16_t port,
|
||||
@ -173,12 +174,13 @@ public:
|
||||
// username and password. Bug # ???
|
||||
std::vector<unsigned char> password(pwd.begin(), pwd.end());
|
||||
|
||||
UniquePtr<NrIceTurnServer> server(NrIceTurnServer::Create(addr, port, username, password,
|
||||
NrIceTurnServer* server(NrIceTurnServer::Create(addr, port, username, password,
|
||||
transport));
|
||||
if (!server) {
|
||||
return false;
|
||||
}
|
||||
addTurnServer(*server);
|
||||
delete server;
|
||||
return true;
|
||||
}
|
||||
void addStunServer(const NrIceStunServer& server) { mStunServers.push_back (server); }
|
||||
|
@ -11,8 +11,8 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
#include "mozilla/Scoped.h"
|
||||
#include "mozilla/SyncRunnable.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include <MediaConduitInterface.h>
|
||||
#include "GmpVideoCodec.h"
|
||||
#include "nsIEventTarget.h"
|
||||
@ -92,8 +92,8 @@ public:
|
||||
{
|
||||
mSession = aSession;
|
||||
mLen = ((width * height) * 3 / 2);
|
||||
mFrame = mozilla::MakeUnique<uint8_t[]>(mLen);
|
||||
memset(mFrame.get(), COLOR, mLen);
|
||||
mFrame = (uint8_t*) PR_MALLOC(mLen);
|
||||
memset(mFrame, COLOR, mLen);
|
||||
numFrames = 121;
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ public:
|
||||
{
|
||||
do
|
||||
{
|
||||
mSession->SendVideoFrame(reinterpret_cast<unsigned char*>(mFrame.get()),
|
||||
mSession->SendVideoFrame((unsigned char*)mFrame,
|
||||
mLen,
|
||||
width,
|
||||
height,
|
||||
@ -115,7 +115,7 @@ public:
|
||||
|
||||
private:
|
||||
RefPtr<mozilla::VideoSessionConduit> mSession;
|
||||
mozilla::UniquePtr<uint8_t[]> mFrame;
|
||||
mozilla::ScopedDeletePtr<uint8_t> mFrame;
|
||||
int mLen;
|
||||
int width, height;
|
||||
int rate;
|
||||
@ -290,8 +290,8 @@ void AudioSendAndReceive::GenerateMusic(short* buf, int len)
|
||||
//Hardcoded for 16 bit samples for now
|
||||
void AudioSendAndReceive::GenerateAndReadSamples()
|
||||
{
|
||||
mozilla::UniquePtr<int16_t[]> audioInput(mozilla::MakeUnique<int16_t []>(PLAYOUT_SAMPLE_LENGTH));
|
||||
mozilla::UniquePtr<int16_t[]> audioOutput(mozilla::MakeUnique<int16_t []>(PLAYOUT_SAMPLE_LENGTH));
|
||||
mozilla::ScopedDeletePtr<int16_t> audioInput(new int16_t [PLAYOUT_SAMPLE_LENGTH]);
|
||||
mozilla::ScopedDeletePtr<int16_t> audioOutput(new int16_t [PLAYOUT_SAMPLE_LENGTH]);
|
||||
short* inbuf;
|
||||
int sampleLengthDecoded = 0;
|
||||
unsigned int SAMPLES = (PLAYOUT_SAMPLE_FREQUENCY * 10); //10 seconds
|
||||
|
@ -1688,19 +1688,19 @@ class SignalingAgentTest : public ::testing::Test {
|
||||
}
|
||||
|
||||
bool CreateAgent(const std::string stun_addr, uint16_t stun_port) {
|
||||
UniquePtr<SignalingAgent> agent(
|
||||
ScopedDeletePtr<SignalingAgent> agent(
|
||||
new SignalingAgent("agent", stun_addr, stun_port));
|
||||
|
||||
agent->Init();
|
||||
|
||||
agents_.push_back(agent.release());
|
||||
agents_.push_back(agent.forget());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CreateAgentNoInit() {
|
||||
UniquePtr<SignalingAgent> agent(new SignalingAgent("agent"));
|
||||
agents_.push_back(agent.release());
|
||||
ScopedDeletePtr<SignalingAgent> agent(new SignalingAgent("agent"));
|
||||
agents_.push_back(agent.forget());
|
||||
}
|
||||
|
||||
SignalingAgent *agent(size_t i) {
|
||||
@ -1749,8 +1749,8 @@ public:
|
||||
if (init_)
|
||||
return;
|
||||
|
||||
a1_ = MakeUnique<SignalingAgent>(callerName, stun_addr_, stun_port_);
|
||||
a2_ = MakeUnique<SignalingAgent>(calleeName, stun_addr_, stun_port_);
|
||||
a1_ = new SignalingAgent(callerName, stun_addr_, stun_port_);
|
||||
a2_ = new SignalingAgent(calleeName, stun_addr_, stun_port_);
|
||||
|
||||
if (GetParam() == "no_bundle") {
|
||||
a1_->SetBundleEnabled(false);
|
||||
@ -2170,8 +2170,8 @@ public:
|
||||
|
||||
protected:
|
||||
bool init_;
|
||||
UniquePtr<SignalingAgent> a1_; // Canonically "caller"
|
||||
UniquePtr<SignalingAgent> a2_; // Canonically "callee"
|
||||
ScopedDeletePtr<SignalingAgent> a1_; // Canonically "caller"
|
||||
ScopedDeletePtr<SignalingAgent> a2_; // Canonically "callee"
|
||||
std::string stun_addr_;
|
||||
uint16_t stun_port_;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user