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

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

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