Fix potential unsafe access to VCMTimestampMap::data

The access to |_timestampMap| was guarded by a lock but
not the access to the data pointer stored in |_timestampMap|.
There was a potential race condition if new data was added
in VCMGenericDecoder::Decode() while the data pointer
retrieved from _timestampMap.Pop() was being used in
VCMDecodedFrameCallback::Decoded().

This CL moves the storage of data to within |_timestampMap|,
instead of being a pointer so that it's guarded by the same
lock.

Bug: webrtc:11229
Change-Id: I3f2afb568ed724db5719d508a73de402c4531dec
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/209361
Commit-Queue: Johannes Kron <kron@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33374}
diff --git a/modules/video_coding/generic_decoder.h b/modules/video_coding/generic_decoder.h
index b595323..2ff6b20 100644
--- a/modules/video_coding/generic_decoder.h
+++ b/modules/video_coding/generic_decoder.h
@@ -29,18 +29,6 @@
 
 enum { kDecoderFrameMemoryLength = 10 };
 
-struct VCMFrameInformation {
-  int64_t renderTimeMs;
-  absl::optional<Timestamp> decodeStart;
-  void* userData;
-  VideoRotation rotation;
-  VideoContentType content_type;
-  EncodedImage::Timing timing;
-  int64_t ntp_time_ms;
-  RtpPacketInfos packet_infos;
-  // ColorSpace is not stored here, as it might be modified by decoders.
-};
-
 class VCMDecodedFrameCallback : public DecodedImageCallback {
  public:
   VCMDecodedFrameCallback(VCMTiming* timing, Clock* clock);
@@ -56,7 +44,7 @@
 
   void OnDecoderImplementationName(const char* implementation_name);
 
-  void Map(uint32_t timestamp, VCMFrameInformation* frameInfo);
+  void Map(uint32_t timestamp, const VCMFrameInformation& frameInfo);
   int32_t Pop(uint32_t timestamp);
 
  private:
@@ -117,7 +105,6 @@
  private:
   VCMDecodedFrameCallback* _callback;
   VCMFrameInformation _frameInfos[kDecoderFrameMemoryLength];
-  uint32_t _nextFrameInfoIdx;
   std::unique_ptr<VideoDecoder> decoder_;
   VideoCodecType _codecType;
   const bool _isExternal;