mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pinossrc: wait for streaming
Wait for the streaming state before completing the negotiation or else we might start reading before we are ready and error out.
This commit is contained in:
		
							parent
							
								
									1b74396562
								
							
						
					
					
						commit
						cc3f49e177
					
				
					 1 changed files with 18 additions and 0 deletions
				
			
		| 
						 | 
					@ -274,9 +274,26 @@ gst_pinos_src_stream_start (GstPinosSrc *pinossrc, GstCaps * caps)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  pinos_main_loop_lock (pinossrc->loop);
 | 
					  pinos_main_loop_lock (pinossrc->loop);
 | 
				
			||||||
  res = pinos_stream_start (pinossrc->stream, format, PINOS_STREAM_MODE_BUFFER);
 | 
					  res = pinos_stream_start (pinossrc->stream, format, PINOS_STREAM_MODE_BUFFER);
 | 
				
			||||||
 | 
					  while (TRUE) {
 | 
				
			||||||
 | 
					    PinosStreamState state = pinos_stream_get_state (pinossrc->stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (state == PINOS_STREAM_STATE_STREAMING)
 | 
				
			||||||
 | 
					      break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (state == PINOS_STREAM_STATE_ERROR)
 | 
				
			||||||
 | 
					      goto start_error;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    pinos_main_loop_wait (pinossrc->loop);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  pinos_main_loop_unlock (pinossrc->loop);
 | 
					  pinos_main_loop_unlock (pinossrc->loop);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return res;
 | 
					  return res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					start_error:
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    GST_DEBUG_OBJECT (pinossrc, "error starting stream");
 | 
				
			||||||
 | 
					    return FALSE;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static gboolean
 | 
					static gboolean
 | 
				
			||||||
| 
						 | 
					@ -369,6 +386,7 @@ gst_pinos_src_negotiate (GstBaseSrc * basesrc)
 | 
				
			||||||
    GST_DEBUG_OBJECT (basesrc, "no common caps");
 | 
					    GST_DEBUG_OBJECT (basesrc, "no common caps");
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  pinossrc->negotiated = result;
 | 
					  pinossrc->negotiated = result;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return result;
 | 
					  return result;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
no_nego_needed:
 | 
					no_nego_needed:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue