Neuter initial packet in the coalescer when discarding initial keys.

PiperOrigin-RevId: 328808677
Change-Id: I34a3dbc33c52146fb88d65c60cdfc5ca8bcf1cf7
diff --git a/quic/core/quic_packet_creator.h b/quic/core/quic_packet_creator.h
index 19f0c2a..02bc9e3 100644
--- a/quic/core/quic_packet_creator.h
+++ b/quic/core/quic_packet_creator.h
@@ -472,6 +472,16 @@
  private:
   friend class test::QuicPacketCreatorPeer;
 
+  // Used to clear queued_frames_ of creator upon exiting the scope.
+  class QUIC_EXPORT_PRIVATE ScopedQueuedFramesCleaner {
+   public:
+    explicit ScopedQueuedFramesCleaner(QuicPacketCreator* creator);
+    ~ScopedQueuedFramesCleaner();
+
+   private:
+    QuicPacketCreator* creator_;  // Unowned.
+  };
+
   // Creates a stream frame which fits into the current open packet. If
   // |data_size| is 0 and fin is true, the expected behavior is to consume
   // the fin.