Changeset 4545:47a468d8b448 in roaraudio


Ignore:
Timestamp:
10/24/10 21:11:48 (11 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

fixed unflag singlesink on mixer bug

Location:
roard
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • roard/include/streams.h

    r4543 r4545  
    112112 struct hwmixer_stream * mixerstream; 
    113113 size_t single_sink_c; 
     114 size_t single_sink_self_c; 
    114115} * g_streams[ROAR_STREAMS_MAX]; 
    115116 
  • roard/streams.c

    r4544 r4545  
    371371  } 
    372372 
    373   if ( (mixer = streams_get_mixer_stream(id)) != -1 ) { 
    374    if ( g_streams[mixer]->flags & ROAR_FLAG_SINGLESINK ) { 
    375     streams_set_mixer_stream(id, -1); 
    376     return -1; 
     373  if ( streams_get_ssdir(id) & STREAM_DIR_OUT ) { 
     374   if ( (mixer = streams_get_mixer_stream(id)) != -1 ) { 
     375    if ( g_streams[mixer]->flags & ROAR_FLAG_SINGLESINK ) { 
     376     streams_set_mixer_stream(id, -1); 
     377     return -1; 
     378    } 
    377379   } 
    378380  } 
     
    807809 mixer = self_ss->mixer_stream; 
    808810 
     811 ROAR_WARN("streams_set_single_sink(id=%i, reset=%i): mixer=%i", id, reset, mixer); 
     812 
    809813 if ( id == mixer ) { 
    810814  if ( reset ) { 
    811    if ( self_ss->single_sink_c > 1 ) { 
     815   if ( self_ss->single_sink_self_c ) { 
     816    ROAR_WARN("streams_set_single_sink(id=%i, reset=%i): mixer=%i", id, reset, mixer); 
     817    self_ss->single_sink_self_c--; 
    812818    self_ss->single_sink_c--; 
    813     self_ss->flags |= ROAR_FLAG_SINGLESINK; 
    814     self_ss->flags -= ROAR_FLAG_SINGLESINK; 
     819    if ( self_ss->single_sink_c == 0 ) { 
     820     ROAR_WARN("streams_set_single_sink(id=%i, reset=%i): mixer=%i", id, reset, mixer); 
     821     self_ss->flags |= ROAR_FLAG_SINGLESINK; 
     822     self_ss->flags -= ROAR_FLAG_SINGLESINK; 
     823    } 
    815824    return 0; 
     825   } else { 
     826    return -1; 
    816827   } 
    817828  } else { 
    818829   if ( self_ss->single_sink_c ) { 
     830    self_ss->single_sink_self_c++; 
    819831    self_ss->single_sink_c++; 
    820832    return 0; 
     
    822834  } 
    823835 } else if ( reset ) { 
     836  ROAR_WARN("streams_set_single_sink(id=%i, reset=%i): mixer=%i", id, reset, mixer); 
     837 
    824838  if ( (ss = g_streams[mixer])->single_sink_c == 0 ) 
    825839   return -1; 
     
    859873 ss = g_streams[mixer]; 
    860874 
     875 if ( id == mixer ) 
     876  ss->single_sink_self_c++; 
     877 
    861878 ss->single_sink_c++; 
    862879 
     
    889906 if ( flag & ROAR_FLAG_SINGLESINK ) { 
    890907  if ( streams_set_single_sink(id, 0) == -1 ) { 
    891    flag -= ROAR_FLAG_SINGLESINK; 
    892    return -1; 
    893   } 
     908   return -1; 
     909  } 
     910  flag -= ROAR_FLAG_SINGLESINK; 
    894911 } 
    895912 
     
    9861003 if ( flag & ROAR_FLAG_SINGLESINK ) { 
    9871004  if ( streams_set_single_sink(id, 1) == -1 ) { 
    988    flag -= ROAR_FLAG_SINGLESINK; 
    989    return -1; 
    990   } 
     1005   return -1; 
     1006  } 
     1007  flag -= ROAR_FLAG_SINGLESINK; 
    9911008 } 
    9921009 
Note: See TracChangeset for help on using the changeset viewer.