Move HdrMetadata to ColorSpace

Move HdrMetadata to ColorSpace as part of preparing for joint transmission
of these two objects.

Bug: webrtc:8651
Change-Id: Ie948011a2c0106d5967cb5ef3b9565217e798272
Reviewed-on: https://webrtc-review.googlesource.com/c/111481
Commit-Queue: Johannes Kron <kron@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25730}
This commit is contained in:
Johannes Kron
2018-11-21 10:18:18 +01:00
committed by Commit Bot
parent ecf6315a7f
commit 4749e4e221
9 changed files with 104 additions and 59 deletions

View File

@ -1199,7 +1199,7 @@ int VP9EncoderImpl::GetEncodedLayerFrame(const vpx_codec_cx_pkt* pkt) {
int qp = -1;
vpx_codec_control(encoder_, VP8E_GET_LAST_QUANTIZER, &qp);
encoded_image_.qp_ = qp;
encoded_image_.SetHdrMetadata(input_image_->hdr_metadata());
encoded_image_.SetColorSpace(input_image_->color_space());
return WEBRTC_VIDEO_CODEC_OK;
}
@ -1339,7 +1339,7 @@ int VP9DecoderImpl::Decode(const EncodedImage& input_image,
vpx_codec_control(decoder_, VPXD_GET_LAST_QUANTIZER, &qp);
RTC_DCHECK_EQ(vpx_ret, VPX_CODEC_OK);
int ret = ReturnFrame(img, input_image.Timestamp(), input_image.ntp_time_ms_,
qp, input_image.HdrMetadata());
qp, input_image.ColorSpace());
if (ret != 0) {
return ret;
}
@ -1350,7 +1350,7 @@ int VP9DecoderImpl::ReturnFrame(const vpx_image_t* img,
uint32_t timestamp,
int64_t ntp_time_ms,
int qp,
const HdrMetadata* hdr_metadata) {
const ColorSpace* explicit_color_space) {
if (img == nullptr) {
// Decoder OK and nullptr image => No show frame.
return WEBRTC_VIDEO_CODEC_NO_OUTPUT;
@ -1392,16 +1392,21 @@ int VP9DecoderImpl::ReturnFrame(const vpx_image_t* img,
return WEBRTC_VIDEO_CODEC_NO_OUTPUT;
}
VideoFrame decoded_image = VideoFrame::Builder()
.set_video_frame_buffer(img_wrapped_buffer)
.set_timestamp_ms(0)
.set_timestamp_rtp(timestamp)
.set_ntp_time_ms(ntp_time_ms)
.set_rotation(webrtc::kVideoRotation_0)
.set_color_space(ExtractVP9ColorSpace(
img->cs, img->range, img->bit_depth))
.set_hdr_metadata(hdr_metadata)
.build();
auto builder = VideoFrame::Builder()
.set_video_frame_buffer(img_wrapped_buffer)
.set_timestamp_ms(0)
.set_timestamp_rtp(timestamp)
.set_ntp_time_ms(ntp_time_ms)
.set_rotation(webrtc::kVideoRotation_0);
if (explicit_color_space) {
builder.set_color_space(explicit_color_space);
} else {
builder.set_color_space(
ExtractVP9ColorSpace(img->cs, img->range, img->bit_depth));
}
VideoFrame decoded_image = builder.build();
decode_complete_callback_->Decoded(decoded_image, absl::nullopt, qp);
return WEBRTC_VIDEO_CODEC_OK;
}