Bug 1109248: Adapt GMP video decoder code to API changes in webrtc.org 40 r=ehugg

This commit is contained in:
Randell Jesup 2015-01-29 18:33:36 -05:00
Родитель d17d6d6c85
Коммит 37194f082b
2 изменённых файлов: 30 добавлений и 7 удалений

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

@ -446,6 +446,11 @@ WebrtcGmpVideoEncoder::Encoded(GMPVideoEncodedFrame* aEncodedFrame,
return;
}
struct nal_entry {
uint32_t offset;
uint32_t size;
};
nsTArray<nal_entry> nals;
uint32_t size;
// make sure we don't read past the end of the buffer getting the size
while (buffer+size_bytes < end) {
@ -484,13 +489,9 @@ WebrtcGmpVideoEncoder::Encoded(GMPVideoEncodedFrame* aEncodedFrame,
buffer+size - end));
return;
}
webrtc::EncodedImage unit(buffer, size, size);
unit._frameType = ft;
unit._timeStamp = timestamp;
unit._completeFrame = true;
mCallback->Encoded(unit, nullptr, nullptr);
// XXX optimize by making buffer an offset
nal_entry nal = {((uint32_t) (buffer-aEncodedFrame->Buffer())), (uint32_t) size};
nals.AppendElement(nal);
buffer += size;
// on last one, buffer == end normally
}
@ -498,6 +499,24 @@ WebrtcGmpVideoEncoder::Encoded(GMPVideoEncodedFrame* aEncodedFrame,
// At most 3 bytes can be left over, depending on buffertype
LOGD(("GMP plugin returned %td extra bytes", end - buffer));
}
size_t num_nals = nals.Length();
if (num_nals > 0) {
webrtc::RTPFragmentationHeader fragmentation;
fragmentation.VerifyAndAllocateFragmentationHeader(num_nals);
for (size_t i = 0; i < num_nals; i++) {
fragmentation.fragmentationOffset[i] = nals[i].offset;
fragmentation.fragmentationLength[i] = nals[i].size;
}
webrtc::EncodedImage unit(aEncodedFrame->Buffer(), size, size);
unit._frameType = ft;
unit._timeStamp = timestamp;
unit._completeFrame = true;
mCallback->Encoded(unit, nullptr, &fragmentation);
}
}
}

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

@ -130,6 +130,10 @@ void VCMEncodedFrame::CopyCodecSpecific(const RTPVideoHeader* header)
break;
}
case kRtpVideoH264: {
_codecSpecificInfo.codecSpecific.H264.nalu_header =
header->codecHeader.H264.nalu_header;
_codecSpecificInfo.codecSpecific.H264.single_nalu =
header->codecHeader.H264.single_nalu;
_codecSpecificInfo.codecType = kVideoCodecH264;
break;
}