File tree 1 file changed +7
-9
lines changed
1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -241,15 +241,13 @@ impl SinkInterface for WebRTCSink {
241
241
warn ! ( "Failed removing WebRTCBin's elements from pipeline: {remove_err:?}" ) ;
242
242
}
243
243
244
- // Set Queue to null
245
- if let Err ( state_err) = self . queue . set_state ( gst:: State :: Null ) {
246
- warn ! ( "Failed to set Queue's state to NULL: {state_err:#?}" ) ;
247
- }
248
-
249
- // Set Sink to null
250
- if let Err ( state_err) = self . webrtcbin . set_state ( gst:: State :: Null ) {
251
- warn ! ( "Failed to set WebRTCBin's to NULL: {state_err:#?}" ) ;
252
- }
244
+ // Instead of setting each element individually to null, we are using a temporary
245
+ // pipeline so we can post and EOS and set the state of the elements to null
246
+ // It is important to send EOS to the queue, otherwise it can hang when setting its state to null.
247
+ let pipeline = gst:: Pipeline :: new ( ) ;
248
+ pipeline. add_many ( elements) . unwrap ( ) ;
249
+ pipeline. post_message ( :: gst:: message:: Eos :: new ( ) ) . unwrap ( ) ;
250
+ pipeline. set_state ( gst:: State :: Null ) . unwrap ( ) ;
253
251
254
252
Ok ( ( ) )
255
253
}
You can’t perform that action at this time.
0 commit comments