Bug 829461: Check for NULL media stream r=ehugg

This commit is contained in:
Adam Roach [:abr] 2013-01-17 15:32:16 -06:00
Родитель a8b6e7b1cd
Коммит d1649a65c9
2 изменённых файлов: 14 добавлений и 5 удалений

Просмотреть файл

@ -167,13 +167,18 @@ public:
case REMOTESTREAMADD: case REMOTESTREAMADD:
{ {
nsDOMMediaStream* stream; nsDOMMediaStream* stream = nullptr;
uint32_t hint; uint32_t hint;
if (!mRemoteStream) { if (!mRemoteStream) {
CSFLogErrorS(logTag, __FUNCTION__ << " GetRemoteStream returned NULL"); CSFLogErrorS(logTag, __FUNCTION__ << " GetRemoteStream returned NULL");
} else { } else {
stream = mRemoteStream->GetMediaStream(); stream = mRemoteStream->GetMediaStream();
}
if (!stream) {
CSFLogErrorS(logTag, __FUNCTION__ << " GetMediaStream returned NULL");
} else {
hint = stream->GetHintContents(); hint = stream->GetHintContents();
if (hint == nsDOMMediaStream::HINT_CONTENTS_AUDIO) { if (hint == nsDOMMediaStream::HINT_CONTENTS_AUDIO) {
mObserver->OnAddStream(stream, "audio"); mObserver->OnAddStream(stream, "audio");

Просмотреть файл

@ -49,7 +49,7 @@ class Fake_AudioGenerator {
public: public:
Fake_AudioGenerator(nsDOMMediaStream* aStream) : mStream(aStream), mCount(0) { Fake_AudioGenerator(nsDOMMediaStream* aStream) : mStream(aStream), mCount(0) {
mTimer = do_CreateInstance("@mozilla.org/timer;1"); mTimer = do_CreateInstance("@mozilla.org/timer;1");
PR_ASSERT(mTimer); MOZ_ASSERT(mTimer);
// Make a track // Make a track
mozilla::AudioSegment *segment = new mozilla::AudioSegment(); mozilla::AudioSegment *segment = new mozilla::AudioSegment();
@ -92,7 +92,7 @@ class Fake_VideoGenerator {
mStream = aStream; mStream = aStream;
mCount = 0; mCount = 0;
mTimer = do_CreateInstance("@mozilla.org/timer;1"); mTimer = do_CreateInstance("@mozilla.org/timer;1");
PR_ASSERT(mTimer); MOZ_ASSERT(mTimer);
// Make a track // Make a track
mozilla::VideoSegment *segment = new mozilla::VideoSegment(); mozilla::VideoSegment *segment = new mozilla::VideoSegment();
@ -161,7 +161,9 @@ class Fake_VideoGenerator {
class LocalSourceStreamInfo { class LocalSourceStreamInfo {
public: public:
LocalSourceStreamInfo(nsDOMMediaStream* aMediaStream) LocalSourceStreamInfo(nsDOMMediaStream* aMediaStream)
: mMediaStream(aMediaStream) {} : mMediaStream(aMediaStream) {
MOZ_ASSERT(aMediaStream);
}
~LocalSourceStreamInfo() { ~LocalSourceStreamInfo() {
mMediaStream = NULL; mMediaStream = NULL;
} }
@ -198,7 +200,9 @@ class RemoteSourceStreamInfo {
public: public:
RemoteSourceStreamInfo(nsDOMMediaStream* aMediaStream) : RemoteSourceStreamInfo(nsDOMMediaStream* aMediaStream) :
mMediaStream(already_AddRefed<nsDOMMediaStream>(aMediaStream)), mMediaStream(already_AddRefed<nsDOMMediaStream>(aMediaStream)),
mPipelines() {} mPipelines() {
MOZ_ASSERT(aMediaStream);
}
nsDOMMediaStream* GetMediaStream() { nsDOMMediaStream* GetMediaStream() {
return mMediaStream; return mMediaStream;