Propagate spatial index to EncodedImage.

Set spatial index of assembled VP9 picture equal to spatial index of
its top spatial layer frame.

Bug: webrtc:10151
Change-Id: Iae40505864b14b01cc6787f8da99a9e3fe283956
Reviewed-on: https://webrtc-review.googlesource.com/c/115280
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26075}
diff --git a/modules/video_coding/encoded_frame.cc b/modules/video_coding/encoded_frame.cc
index ad28ec2..e19146d 100644
--- a/modules/video_coding/encoded_frame.cc
+++ b/modules/video_coding/encoded_frame.cc
@@ -44,6 +44,7 @@
 
 void VCMEncodedFrame::Reset() {
   SetTimestamp(0);
+  SetSpatialIndex(absl::nullopt);
   _renderTimeMs = -1;
   _payloadType = 0;
   _frameType = kVideoFrameDelta;
@@ -116,6 +117,7 @@
         if (vp9_header.spatial_idx != kNoSpatialIdx) {
           _codecSpecificInfo.codecSpecific.VP9.inter_layer_predicted =
               vp9_header.inter_layer_predicted;
+          SetSpatialIndex(vp9_header.spatial_idx);
         }
         if (vp9_header.gof_idx != kNoGofIdx) {
           _codecSpecificInfo.codecSpecific.VP9.gof_idx = vp9_header.gof_idx;