@@ -1038,7 +1038,6 @@ static void DecoderProcessVideo( decoder_t *p_dec, block_t *p_block )
1038
1038
}
1039
1039
1040
1040
static int DecoderPlayAudio ( decoder_t * p_dec , block_t * p_audio ,
1041
- unsigned * restrict pi_played_sum ,
1042
1041
unsigned * restrict pi_lost_sum )
1043
1042
{
1044
1043
decoder_owner_sys_t * p_owner = p_dec -> p_owner ;
@@ -1093,35 +1092,40 @@ static int DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio,
1093
1092
1094
1093
audio_output_t * p_aout = p_owner -> p_aout ;
1095
1094
1096
- if ( p_aout == NULL || p_audio -> i_pts <= VLC_TS_INVALID
1097
- || i_rate < INPUT_RATE_DEFAULT /AOUT_MAX_INPUT_RATE
1098
- || i_rate > INPUT_RATE_DEFAULT * AOUT_MAX_INPUT_RATE
1099
- || DecoderTimedWait ( p_dec , p_audio -> i_pts - AOUT_MAX_PREPARE_TIME ) )
1095
+ if ( p_aout != NULL && p_audio -> i_pts > VLC_TS_INVALID
1096
+ && i_rate >= INPUT_RATE_DEFAULT /AOUT_MAX_INPUT_RATE
1097
+ && i_rate <= INPUT_RATE_DEFAULT * AOUT_MAX_INPUT_RATE
1098
+ && !DecoderTimedWait ( p_dec , p_audio -> i_pts - AOUT_MAX_PREPARE_TIME ) )
1099
+ {
1100
+ aout_DecPlay ( p_aout , p_audio , i_rate );
1101
+ }
1102
+ else
1100
1103
{
1101
1104
msg_Dbg ( p_dec , "discarded audio buffer" );
1102
1105
* pi_lost_sum += 1 ;
1103
1106
block_Release ( p_audio );
1104
- return 0 ;
1105
1107
}
1106
-
1107
- if ( aout_DecPlay ( p_aout , p_audio , i_rate ) == 0 )
1108
- * pi_played_sum += 1 ;
1109
-
1110
1108
return 0 ;
1111
1109
}
1112
1110
1113
1111
static void DecoderUpdateStatAudio ( decoder_t * p_dec , unsigned decoded ,
1114
- unsigned lost , unsigned played )
1112
+ unsigned lost )
1115
1113
{
1116
1114
decoder_owner_sys_t * p_owner = p_dec -> p_owner ;
1117
1115
input_thread_t * p_input = p_owner -> p_input ;
1116
+ unsigned played = 0 ;
1118
1117
1119
1118
/* Update ugly stat */
1120
1119
if ( p_input == NULL )
1121
1120
return ;
1122
1121
1123
1122
if ( p_owner -> p_aout != NULL )
1124
- lost += aout_DecGetResetLost ( p_owner -> p_aout );
1123
+ {
1124
+ unsigned aout_lost ;
1125
+
1126
+ aout_DecGetResetStats ( p_owner -> p_aout , & aout_lost , & played );
1127
+ lost += aout_lost ;
1128
+ }
1125
1129
1126
1130
vlc_mutex_lock ( & p_input -> p -> counters .counters_lock );
1127
1131
stats_Update ( p_input -> p -> counters .p_lost_abuffers , lost , NULL );
@@ -1132,11 +1136,11 @@ static void DecoderUpdateStatAudio( decoder_t *p_dec, unsigned decoded,
1132
1136
1133
1137
static int DecoderQueueAudio ( decoder_t * p_dec , block_t * p_aout_buf )
1134
1138
{
1135
- unsigned i_lost = 0 , i_played = 0 ;
1139
+ unsigned lost = 0 ;
1136
1140
1137
- int ret = DecoderPlayAudio ( p_dec , p_aout_buf , & i_played , & i_lost );
1141
+ int ret = DecoderPlayAudio ( p_dec , p_aout_buf , & lost );
1138
1142
1139
- DecoderUpdateStatAudio ( p_dec , 1 , i_lost , i_played );
1143
+ DecoderUpdateStatAudio ( p_dec , 1 , lost );
1140
1144
1141
1145
return ret ;
1142
1146
}
@@ -1145,16 +1149,16 @@ static void DecoderDecodeAudio( decoder_t *p_dec, block_t *p_block )
1145
1149
{
1146
1150
block_t * p_aout_buf ;
1147
1151
block_t * * pp_block = p_block ? & p_block : NULL ;
1148
- unsigned i_decoded = 0 , i_lost = 0 , i_played = 0 ;
1152
+ unsigned decoded = 0 , lost = 0 ;
1149
1153
1150
1154
while ( (p_aout_buf = p_dec -> pf_decode_audio ( p_dec , pp_block ) ) )
1151
1155
{
1152
- i_decoded ++ ;
1156
+ decoded ++ ;
1153
1157
1154
- DecoderPlayAudio ( p_dec , p_aout_buf , & i_played , & i_lost );
1158
+ DecoderPlayAudio ( p_dec , p_aout_buf , & lost );
1155
1159
}
1156
1160
1157
- DecoderUpdateStatAudio ( p_dec , i_decoded , i_lost , i_played );
1161
+ DecoderUpdateStatAudio ( p_dec , decoded , lost );
1158
1162
}
1159
1163
1160
1164
/* This function process a audio block
0 commit comments