mirror of
https://github.com/aler9/rtsp-simple-server
synced 2025-10-21 22:59:37 +08:00
refactor: use the built-in max/min to simplify the code (#4867)
Signed-off-by: alex9long <alex9long@outlook.com>
This commit is contained in:
@@ -40,10 +40,7 @@ func (c *Chunk1) Read(r io.Reader, maxBodyLen uint32, _ bool) error {
|
||||
c.TimestampDelta = uint32(header[0])<<24 | uint32(header[1])<<16 | uint32(header[2])<<8 | uint32(header[3])
|
||||
}
|
||||
|
||||
chunkBodyLen := (c.BodyLen)
|
||||
if chunkBodyLen > maxBodyLen {
|
||||
chunkBodyLen = maxBodyLen
|
||||
}
|
||||
chunkBodyLen := min((c.BodyLen), maxBodyLen)
|
||||
|
||||
c.Body = make([]byte, chunkBodyLen)
|
||||
_, err = io.ReadFull(r, c.Body)
|
||||
|
||||
Reference in New Issue
Block a user