[xiph-commits] r3083 - liboggplay/trunk/plugin
shans at svn.annodex.net
shans at svn.annodex.net
Tue Jun 26 21:44:40 PDT 2007
Author: shans
Date: 2007-06-26 21:44:40 -0700 (Tue, 26 Jun 2007)
New Revision: 3083
Modified:
liboggplay/trunk/plugin/plugin_gui_linux.c
Log:
minor comments and neatenings
Modified: liboggplay/trunk/plugin/plugin_gui_linux.c
===================================================================
--- liboggplay/trunk/plugin/plugin_gui_linux.c 2007-06-27 04:42:16 UTC (rev 3082)
+++ liboggplay/trunk/plugin/plugin_gui_linux.c 2007-06-27 04:44:40 UTC (rev 3083)
@@ -186,16 +186,20 @@
(
frame_data.size > 0
&&
- sa_device_write(info->audio_handle, frame_data.size, frame_data.samples) > 0
+ sa_device_write(info->audio_handle, frame_data.size,
+ frame_data.samples) > 0
)
{
+ /* can't write data */
cur_time = oggplay_sys_time_in_ms();
}
- /* get audio playback progress */
+ /* get audio playback progress */
else if (sa_device_get_position(info->audio_handle,
SA_PCM_WRITE_SOFTWARE_POS, &bytes) > 0) {
+ /* can't get progress */
cur_time = oggplay_sys_time_in_ms();
} else {
+ /* calculate time from playback bytepos */
cur_time = (bytes * 1000 / get_audio_rate(info->ogg_handle) /
(sizeof(short) * get_audio_channels(info->ogg_handle)));
}
@@ -206,20 +210,25 @@
}
/* clean up */
-
free_oggplay_frame(info->ogg_handle, &frame_data);
info->playback_target += get_callback_period(info->ogg_handle);
offset = (info->playback_target >> 16) - cur_time;
//printf("target: %lld offset: %lld\n", info->playback_target, offset);
+ /*
+ * if we're WAAAY behind, discard the next frame
+ */
if (offset < OGGPLAY_FRAME_SKIP_OFFSET) {
get_oggplay_frame(info->ogg_handle, &frame_data);
goto calc_offset;
} else if (offset < OGGPLAY_MIN_OFFSET) {
offset = OGGPLAY_MIN_OFFSET;
}
-
+
+ /*
+ * set new timeout and invalidate old one
+ */
info->timeout_id = g_timeout_add((int)offset, update_frame, (gpointer)info);
return FALSE;
}
More information about the commits
mailing list