Bug 1369724: Fix setting size for fake H264 codec r=jya

From bug 1341285

MozReview-Commit-ID: E6g6phiQC5H
This commit is contained in:
Randell Jesup 2017-06-02 09:59:36 -04:00
Родитель 748457c51a
Коммит 712586b20b
2 изменённых файлов: 6 добавлений и 4 удалений

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

@ -205,7 +205,8 @@ class FakeVideoEncoder : public GMPVideoEncoder {
}
memcpy(f->Buffer(), &eframe, sizeof(eframe));
if (frame_type == kGMPKeyFrame) {
*((uint32_t*) f->Buffer() + sizeof(eframe)) = BIG_FRAME;
// set the size for the fake iframe
*((uint32_t*) (f->Buffer() + sizeof(eframe))) = BIG_FRAME;
}
f->SetEncodedWidth (inputImage->Width());

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

@ -591,11 +591,12 @@ WebrtcGmpVideoEncoder::Encoded(GMPVideoEncodedFrame* aEncodedFrame,
default:
MOZ_CRASH("GMP_BufferType already handled in switch above");
}
if (buffer+size > end) {
MOZ_ASSERT(size != 0 &&
buffer+size <= end); // in non-debug code, don't crash in this case
if (size == 0 || buffer+size > end) {
// XXX see above - should we kill the plugin for returning extra bytes? Probably
LOG(LogLevel::Error,
("GMP plugin returned badly formatted encoded data: end is %td bytes past buffer end",
buffer+size - end));
("GMP plugin returned badly formatted encoded data: buffer=%p, size=%d, end=%p", buffer, size, end));
return;
}
// XXX optimize by making buffer an offset