Skip to content

Commit

Permalink
When reconfiguring VP9 restore previous input pixel format
Browse files Browse the repository at this point in the history
Otherwise if the pixel format is not I420, the image buffer will
need to be reallocated on each reconfiguration.

Bug: webrtc:11974
Change-Id: Ib13f1865d7dbba4635f57dc09c7bff846e127585
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186340
Reviewed-by: Ilya Nikolaevskiy <[email protected]>
Commit-Queue: Evan Shrubsole <[email protected]>
Cr-Commit-Position: refs/heads/master@{#32281}
  • Loading branch information
eshrubs authored and Commit Bot committed Oct 1, 2020
1 parent b3d539e commit c082eba
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/video_coding/codecs/vp9/vp9_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,9 @@ int VP9EncoderImpl::InitEncode(const VideoCodec* inst,
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
}

absl::optional<vpx_img_fmt_t> previous_img_fmt =
raw_ ? absl::make_optional<vpx_img_fmt_t>(raw_->fmt) : absl::nullopt;

int ret_val = Release();
if (ret_val < 0) {
return ret_val;
Expand Down Expand Up @@ -530,7 +533,7 @@ int VP9EncoderImpl::InitEncode(const VideoCodec* inst,
unsigned int bits_for_storage = 8;
switch (profile_) {
case VP9Profile::kProfile0:
img_fmt = VPX_IMG_FMT_I420;
img_fmt = previous_img_fmt.value_or(VPX_IMG_FMT_I420);
bits_for_storage = 8;
config_->g_bit_depth = VPX_BITS_8;
config_->g_profile = 0;
Expand Down

0 comments on commit c082eba

Please sign in to comment.