Add spatial index to EncodedImage.

Replaces the VP8 simulcast index and VP9 spatial index formely part of
CodecSpecificInfo.

Bug: webrtc:9378
Change-Id: I80eafd63fbdee0a25864338196a690628b4bd3d2
Reviewed-on: https://webrtc-review.googlesource.com/83161
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24485}
This commit is contained in:
Niels Möller
2018-08-27 15:33:42 +02:00
committed by Commit Bot
parent 02e9e44c0c
commit da0898dfae
30 changed files with 160 additions and 215 deletions

View File

@ -56,22 +56,17 @@ size_t GetMaxNaluSizeBytes(const EncodedImage& encoded_frame,
return max_size;
}
void GetLayerIndices(const CodecSpecificInfo& codec_specific,
size_t* spatial_idx,
size_t* temporal_idx) {
size_t GetTemporalLayerIndex(const CodecSpecificInfo& codec_specific) {
size_t temporal_idx = 0;
if (codec_specific.codecType == kVideoCodecVP8) {
*spatial_idx = codec_specific.codecSpecific.VP8.simulcastIdx;
*temporal_idx = codec_specific.codecSpecific.VP8.temporalIdx;
temporal_idx = codec_specific.codecSpecific.VP8.temporalIdx;
} else if (codec_specific.codecType == kVideoCodecVP9) {
*spatial_idx = codec_specific.codecSpecific.VP9.spatial_idx;
*temporal_idx = codec_specific.codecSpecific.VP9.temporal_idx;
temporal_idx = codec_specific.codecSpecific.VP9.temporal_idx;
}
if (*spatial_idx == kNoSpatialIdx) {
*spatial_idx = 0;
}
if (*temporal_idx == kNoTemporalIdx) {
*temporal_idx = 0;
if (temporal_idx == kNoTemporalIdx) {
temporal_idx = 0;
}
return temporal_idx;
}
int GetElapsedTimeMicroseconds(int64_t start_ns, int64_t stop_ns) {
@ -347,9 +342,8 @@ void VideoProcessor::FrameEncoded(
}
// Layer metadata.
size_t spatial_idx = 0;
size_t temporal_idx = 0;
GetLayerIndices(codec_specific, &spatial_idx, &temporal_idx);
size_t spatial_idx = encoded_image.SpatialIndex().value_or(0);
size_t temporal_idx = GetTemporalLayerIndex(codec_specific);
FrameStatistics* frame_stat =
stats_->GetFrameWithTimestamp(encoded_image.Timestamp(), spatial_idx);