Changeset 8a0dc31dcad18b36c9545910c0e09b22a4c6c020
- Timestamp:
- 13/05/08 12:15:42
(5 months ago)
- Author:
- Rafaël Carré <funman@videolan.org>
- git-committer:
- Rafaël Carré <funman@videolan.org> 1210673742 +0200
- git-parent:
[6ba2378ea683a7cbab6739cb18b64324ba56a377]
- git-author:
- Rafaël Carré <funman@videolan.org> 1210673742 +0200
- Message:
Fix cyclic dependancy between input and "sout stream" description
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rff9f9ff |
r8a0dc31 |
|
| 58 | 58 | struct sout_stream_sys_t |
|---|
| 59 | 59 | { |
|---|
| 60 | | int i_id; |
|---|
| 61 | 60 | input_thread_t *p_input; |
|---|
| 62 | 61 | |
|---|
| … | … | |
| 82 | 81 | p_sys = p_stream->p_sys = malloc(sizeof(sout_stream_sys_t)); |
|---|
| 83 | 82 | |
|---|
| 84 | | p_sys->i_id = 0; |
|---|
| 85 | 83 | p_sys->p_input = NULL; |
|---|
| 86 | 84 | |
|---|
| … | … | |
| 98 | 96 | sout_stream_sys_t *p_sys = p_stream->p_sys; |
|---|
| 99 | 97 | |
|---|
| 100 | | msg_Dbg( p_this, "description: Closing the module" ); |
|---|
| 101 | | |
|---|
| 102 | | /* It can happen only if buggy */ |
|---|
| 103 | | assert( !p_sys->p_input ); |
|---|
| | 98 | msg_Dbg( p_this, "Closing" ); |
|---|
| 104 | 99 | |
|---|
| 105 | 100 | free( p_sys ); |
|---|
| … | … | |
| 113 | 108 | input_item_t *p_item; |
|---|
| 114 | 109 | |
|---|
| 115 | | msg_Dbg( p_stream, "description: Adding a stream" ); |
|---|
| | 110 | msg_Dbg( p_stream, "Adding a stream" ); |
|---|
| 116 | 111 | |
|---|
| 117 | 112 | if( !p_sys->p_input ) |
|---|
| 118 | | p_sys->p_input = vlc_object_find( p_stream, VLC_OBJECT_INPUT, FIND_PARENT ); |
|---|
| 119 | | if( !p_sys->p_input ) |
|---|
| 120 | | return NULL; |
|---|
| | 113 | { |
|---|
| | 114 | p_sys->p_input = vlc_object_find( p_stream, VLC_OBJECT_INPUT, |
|---|
| | 115 | FIND_PARENT ); |
|---|
| | 116 | /* This module is a children of the input object |
|---|
| | 117 | * We don't want to keep a reference on it, because we will be alive |
|---|
| | 118 | * as long as the input is alive. |
|---|
| | 119 | * |
|---|
| | 120 | * Since vlc_object_find() increments the reference count, |
|---|
| | 121 | * we release the input just after finding it. |
|---|
| | 122 | * */ |
|---|
| | 123 | assert( p_sys->p_input ); |
|---|
| | 124 | vlc_object_release( p_sys->p_input ); |
|---|
| | 125 | } |
|---|
| 121 | 126 | |
|---|
| 122 | 127 | p_item = input_GetItem(p_sys->p_input); |
|---|
| … | … | |
| 129 | 134 | vlc_mutex_unlock( &p_item->lock ); |
|---|
| 130 | 135 | |
|---|
| 131 | | p_sys->i_id++; |
|---|
| 132 | 136 | if( p_sys->i_stream_start <= 0 ) |
|---|
| 133 | 137 | p_sys->i_stream_start = mdate(); |
|---|
| … | … | |
| 142 | 146 | sout_stream_sys_t *p_sys = p_stream->p_sys; |
|---|
| 143 | 147 | |
|---|
| 144 | | msg_Dbg( p_stream, "description: Removing a stream (id:%d)", p_sys->i_id ); |
|---|
| 145 | | |
|---|
| 146 | | p_sys->i_id--; |
|---|
| 147 | | if( p_sys->i_id <= 0 ) |
|---|
| 148 | | { |
|---|
| 149 | | vlc_object_release( p_sys->p_input ); |
|---|
| 150 | | p_sys->p_input = NULL; |
|---|
| 151 | | } |
|---|
| | 148 | msg_Dbg( p_stream, "Removing a stream" ); |
|---|
| 152 | 149 | |
|---|
| 153 | 150 | free( id ); |
|---|