[Asterisk-code-review] core: Don't attempt to write to a stream that does not exist. (asterisk[15])
Jenkins2
asteriskteam at digium.com
Thu Nov 2 11:13:47 CDT 2017
Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/6962 )
Change subject: core: Don't attempt to write to a stream that does not exist.
......................................................................
core: Don't attempt to write to a stream that does not exist.
When a frame is provided to ast_write ensure that a multistream
capable channel has a stream for it before attempting to give it
to the channel driver. In some cases (such as a deferred SDP
negotiation) the stream may not yet exist.
ASTERISK-27364
Change-Id: Icf84ca982a67cdd6e9a71851eb7eb1bd0e865276
---
M main/channel.c
1 file changed, 15 insertions(+), 3 deletions(-)
Approvals:
George Joseph: Looks good to me, but someone else must approve
Matthew Fredrickson: Looks good to me, approved
Jenkins2: Approved for Submit
diff --git a/main/channel.c b/main/channel.c
index 7d6e5db..7eb40d1 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -5054,7 +5054,11 @@
case AST_FRAME_VIDEO:
/* XXX Handle translation of video codecs one day XXX */
if (ast_channel_tech(chan)->write_stream) {
- res = ast_channel_tech(chan)->write_stream(chan, ast_stream_get_position(stream), fr);
+ if (stream) {
+ res = ast_channel_tech(chan)->write_stream(chan, ast_stream_get_position(stream), fr);
+ } else {
+ res = 0;
+ }
} else if ((stream == default_stream) && ast_channel_tech(chan)->write_video) {
res = ast_channel_tech(chan)->write_video(chan, fr);
} else {
@@ -5063,7 +5067,11 @@
break;
case AST_FRAME_MODEM:
if (ast_channel_tech(chan)->write_stream) {
- res = ast_channel_tech(chan)->write_stream(chan, ast_stream_get_position(stream), fr);
+ if (stream) {
+ res = ast_channel_tech(chan)->write_stream(chan, ast_stream_get_position(stream), fr);
+ } else {
+ res = 0;
+ }
} else if ((stream == default_stream) && ast_channel_tech(chan)->write) {
res = ast_channel_tech(chan)->write(chan, fr);
} else {
@@ -5251,7 +5259,11 @@
f = NULL;
} else {
if (ast_channel_tech(chan)->write_stream) {
- res = ast_channel_tech(chan)->write_stream(chan, ast_stream_get_position(stream), f);
+ if (stream) {
+ res = ast_channel_tech(chan)->write_stream(chan, ast_stream_get_position(stream), f);
+ } else {
+ res = 0;
+ }
} else if ((stream == default_stream) && ast_channel_tech(chan)->write) {
res = ast_channel_tech(chan)->write(chan, f);
} else {
--
To view, visit https://gerrit.asterisk.org/6962
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: merged
Gerrit-Change-Id: Icf84ca982a67cdd6e9a71851eb7eb1bd0e865276
Gerrit-Change-Number: 6962
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Matthew Fredrickson <creslin at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171102/6d4a6492/attachment-0001.html>
More information about the asterisk-code-review
mailing list