Bug 1514158 - Fix MediaRecorder static-analysis warnings. r=bryce

Differential Revision: https://phabricator.services.mozilla.com/D41588

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Pehrson 2019-10-03 22:09:06 +00:00
Родитель 2c2903d85c
Коммит 24e87cb986
2 изменённых файлов: 10 добавлений и 7 удалений

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

@ -304,13 +304,13 @@ class MediaRecorder::Session : public PrincipalChangeObserver<MediaStreamTrack>,
Run() override {
MOZ_ASSERT(NS_IsMainThread());
mSession->MaybeCreateMutableBlobStorage();
for (uint32_t i = 0; i < mBuffer.Length(); i++) {
if (mBuffer[i].IsEmpty()) {
for (const auto& part : mBuffer) {
if (part.IsEmpty()) {
continue;
}
nsresult rv = mSession->mMutableBlobStorage->Append(
mBuffer[i].Elements(), mBuffer[i].Length());
nsresult rv = mSession->mMutableBlobStorage->Append(part.Elements(),
part.Length());
if (NS_WARN_IF(NS_FAILED(rv))) {
mSession->DoSessionEndTask(rv);
break;
@ -1550,7 +1550,9 @@ template <class String>
static bool CodecListContains(char const* const* aCodecs,
const String& aCodec) {
for (int32_t i = 0; aCodecs[i]; ++i) {
if (aCodec.EqualsASCII(aCodecs[i])) return true;
if (aCodec.EqualsASCII(aCodecs[i])) {
return true;
}
}
return false;
}

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

@ -82,8 +82,9 @@ class MediaRecorder final : public DOMEventTargetHelper,
// The current state of the MediaRecorder object.
RecordingState State() const { return mState; }
static bool IsTypeSupported(GlobalObject& aGlobal, const nsAString& aType);
static bool IsTypeSupported(const nsAString& aType);
static bool IsTypeSupported(GlobalObject& aGlobal,
const nsAString& aMIMEType);
static bool IsTypeSupported(const nsAString& aMIMEType);
// Construct a recorder with a DOM media stream object as its source.
static already_AddRefed<MediaRecorder> Constructor(