Delete VCMEncodedFrame::VerifyAndAllocate
And mark EncodedImage::Allocate as deprecated. Bug: webrtc:9378 Change-Id: I03ce907fa6b87803ddb72f548f60a9bf1b7c317d Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/155163 Reviewed-by: Philip Eliasson <philipel@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29383}
This commit is contained in:
@ -1136,16 +1136,20 @@ int LibvpxVp8Encoder::GetEncodedPartitions(const VideoFrame& input_image,
|
||||
encoded_images_[encoder_idx]._frameType = VideoFrameType::kVideoFrameDelta;
|
||||
CodecSpecificInfo codec_specific;
|
||||
const vpx_codec_cx_pkt_t* pkt = NULL;
|
||||
|
||||
// TODO(nisse): Introduce some buffer cache or buffer pool, to reduce
|
||||
// allocations and/or copy operations.
|
||||
auto buffer = EncodedImageBuffer::Create();
|
||||
|
||||
while ((pkt = libvpx_->codec_get_cx_data(&encoders_[encoder_idx], &iter)) !=
|
||||
NULL) {
|
||||
switch (pkt->kind) {
|
||||
case VPX_CODEC_CX_FRAME_PKT: {
|
||||
const size_t size = encoded_images_[encoder_idx].size();
|
||||
const size_t size = buffer->size();
|
||||
const size_t new_size = pkt->data.frame.sz + size;
|
||||
encoded_images_[encoder_idx].Allocate(new_size);
|
||||
memcpy(&encoded_images_[encoder_idx].data()[size],
|
||||
pkt->data.frame.buf, pkt->data.frame.sz);
|
||||
encoded_images_[encoder_idx].set_size(new_size);
|
||||
buffer->Realloc(new_size);
|
||||
memcpy(&buffer->data()[size], pkt->data.frame.buf,
|
||||
pkt->data.frame.sz);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -1158,6 +1162,7 @@ int LibvpxVp8Encoder::GetEncodedPartitions(const VideoFrame& input_image,
|
||||
encoded_images_[encoder_idx]._frameType =
|
||||
VideoFrameType::kVideoFrameKey;
|
||||
}
|
||||
encoded_images_[encoder_idx].SetEncodedData(buffer);
|
||||
encoded_images_[encoder_idx].SetSpatialIndex(stream_idx);
|
||||
PopulateCodecSpecific(&codec_specific, *pkt, stream_idx, encoder_idx,
|
||||
input_image.timestamp());
|
||||
|
||||
Reference in New Issue
Block a user