diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-04-15 20:04:20 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-04-15 20:04:20 +0000 |
commit | 53c494103eb8376ee303dec4f367a79ff7ff6b5c (patch) | |
tree | 715204e4a9e7429cfe08d2dd3c9a06d56a27eb0d /main/file.c | |
parent | 3f0f4524766212d1f67370eb615b93596b70423b (diff) |
Update ast_readvideo_callback to match ast_readaudio_callback.
This fixes potential refcount errors that may occur on ast_filestreams.
AST-208
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@188582 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/file.c')
-rw-r--r-- | main/file.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/main/file.c b/main/file.c index 8e8388014..8614a6def 100644 --- a/main/file.c +++ b/main/file.c @@ -798,12 +798,21 @@ static enum fsread_res ast_readvideo_callback(struct ast_filestream *s) while (!whennext) { struct ast_frame *fr = s->fmt->read(s, &whennext); - if (!fr || ast_write(s->owner, fr)) { /* no stream or error, as above */ - if (fr) + if (fr) { + ast_set_flag(fr, AST_FRFLAG_FROM_FILESTREAM); + ao2_ref(s, +1); + } + if (!fr /* stream complete */ || ast_write(s->owner, fr) /* error writing */) { + if (fr) { ast_log(LOG_WARNING, "Failed to write frame\n"); + ast_frfree(fr); + } s->owner->vstreamid = -1; return FSREAD_FAILURE; } + if (fr) { + ast_frfree(fr); + } } if (whennext != s->lasttimeout) { |