VideoProcessorImpl using EncodedImage::GetBufferPaddingBytes.
BUG=https://bugs.chromium.org/p/webrtc/issues/detail?id=5424 Review URL: https://codereview.webrtc.org/1618853002 Cr-Commit-Position: refs/heads/master@{#11353}
This commit is contained in:
@ -225,7 +225,8 @@ bool VideoProcessorImpl::ProcessFrame(int frame_number) {
|
||||
}
|
||||
}
|
||||
|
||||
void VideoProcessorImpl::FrameEncoded(const EncodedImage& encoded_image) {
|
||||
void VideoProcessorImpl::FrameEncoded(webrtc::VideoCodecType codec,
|
||||
const EncodedImage& encoded_image) {
|
||||
// Timestamp is frame number, so this gives us #dropped frames.
|
||||
int num_dropped_from_prev_encode =
|
||||
encoded_image._timeStamp - prev_time_stamp_ - 1;
|
||||
@ -276,11 +277,13 @@ void VideoProcessorImpl::FrameEncoded(const EncodedImage& encoded_image) {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
rtc::scoped_ptr<uint8_t[]> copied_buffer(new uint8_t[encoded_image._length]);
|
||||
size_t copied_buffer_size = encoded_image._length +
|
||||
EncodedImage::GetBufferPaddingBytes(codec);
|
||||
rtc::scoped_ptr<uint8_t[]> copied_buffer(new uint8_t[copied_buffer_size]);
|
||||
memcpy(copied_buffer.get(), encoded_image._buffer, encoded_image._length);
|
||||
EncodedImage copied_image;
|
||||
memcpy(&copied_image, &encoded_image, sizeof(copied_image));
|
||||
copied_image._size = copied_image._length;
|
||||
copied_image._size = copied_buffer_size;
|
||||
copied_image._buffer = copied_buffer.get();
|
||||
if (!exclude_this_frame) {
|
||||
stat.packets_dropped =
|
||||
@ -412,12 +415,14 @@ int32_t VideoProcessorImpl::VideoProcessorEncodeCompleteCallback::Encoded(
|
||||
const EncodedImage& encoded_image,
|
||||
const webrtc::CodecSpecificInfo* codec_specific_info,
|
||||
const webrtc::RTPFragmentationHeader* fragmentation) {
|
||||
video_processor_->FrameEncoded(encoded_image); // Forward to parent class.
|
||||
RTC_CHECK(codec_specific_info);
|
||||
video_processor_->FrameEncoded(codec_specific_info->codecType,
|
||||
encoded_image); // Forward to parent class.
|
||||
return 0;
|
||||
}
|
||||
int32_t VideoProcessorImpl::VideoProcessorDecodeCompleteCallback::Decoded(
|
||||
VideoFrame& image) {
|
||||
video_processor_->FrameDecoded(image); // forward to parent class
|
||||
video_processor_->FrameDecoded(image); // Forward to parent class.
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -172,7 +172,8 @@ class VideoProcessorImpl : public VideoProcessor {
|
||||
|
||||
private:
|
||||
// Invoked by the callback when a frame has completed encoding.
|
||||
void FrameEncoded(const webrtc::EncodedImage& encodedImage);
|
||||
void FrameEncoded(webrtc::VideoCodecType codec,
|
||||
const webrtc::EncodedImage& encodedImage);
|
||||
// Invoked by the callback when a frame has completed decoding.
|
||||
void FrameDecoded(const webrtc::VideoFrame& image);
|
||||
// Used for getting a 32-bit integer representing time
|
||||
|
||||
Reference in New Issue
Block a user