mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
stream: Enforce formats immutability and ensure formats exist.
Some places in Asterisk did not treat the formats on a stream as immutable when they are. The ast_stream_get_formats function is now const to enforce this and parts of Asterisk have been updated to take this into account. Some violations of this were also fixed along the way. An additional minor tweak is that streams are now allocated with an empty format capabilities structure removing the need in various places to check that one is present on the stream. ASTERISK-28846 Change-Id: I32f29715330db4ff48edd6f1f359090458a9bfbe
This commit is contained in:
committed by
Kevin Harwell
parent
9ad3d2829c
commit
1c5e68580a
@@ -1752,9 +1752,11 @@ static int sip_session_refresh(struct ast_sip_session *session,
|
||||
continue;
|
||||
} else {
|
||||
/* However if the stream is otherwise remaining the same we can keep the formats
|
||||
* that exist on it already which allows media to continue to flow.
|
||||
* that exist on it already which allows media to continue to flow. We don't modify
|
||||
* the format capabilities but do need to cast it so that ao2_bump can raise the
|
||||
* reference count.
|
||||
*/
|
||||
joint_cap = ao2_bump(ast_stream_get_formats(existing_stream));
|
||||
joint_cap = ao2_bump((struct ast_format_cap *)ast_stream_get_formats(existing_stream));
|
||||
}
|
||||
}
|
||||
ast_stream_set_formats(stream, joint_cap);
|
||||
|
Reference in New Issue
Block a user