Add sizes of spatial layer frames to EncodedImage

WebRTC combines VP9 SVC spatial layer frames into superframe and passes
it to a decoder. The chromium HW VP9 decoder (wrapper) needs to know
location of each spatial layer frame in the frame buffer. To provide
decoder with such information this CL:
- Adds Set/SpatialLayerFrameSize methods to EncodedImage.
- Sets size of each spatial layer frame on superframe at assembly stage.

Bug: webrtc:10495
Change-Id: I68c3c0d668c67dfa1740e004059d860dd98f67f9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/136922
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28032}
diff --git a/modules/video_coding/frame_buffer2.cc b/modules/video_coding/frame_buffer2.cc
index a467662..80d1aec 100644
--- a/modules/video_coding/frame_buffer2.cc
+++ b/modules/video_coding/frame_buffer2.cc
@@ -737,6 +737,9 @@
   }
   first_frame->VerifyAndAllocate(total_length);
 
+  first_frame->SetSpatialLayerFrameSize(first_frame->id.spatial_layer,
+                                        first_frame->size());
+
   // Spatial index of combined frame is set equal to spatial index of its top
   // spatial layer.
   first_frame->SetSpatialIndex(last_frame->id.spatial_layer);
@@ -751,6 +754,8 @@
   uint8_t* buffer = first_frame->data() + first_frame->size();
   for (size_t i = 1; i < frames.size(); ++i) {
     EncodedFrame* next_frame = frames[i];
+    first_frame->SetSpatialLayerFrameSize(next_frame->id.spatial_layer,
+                                          next_frame->size());
     memcpy(buffer, next_frame->data(), next_frame->size());
     buffer += next_frame->size();
     delete next_frame;