Advertising
- yield_codec returns
- Monday, November 5th, 2007 at 1:50:33pm MST
- diff --git a/apps/buffering.c b/apps/buffering.c
- index dcc753e..0fe6e5e 100644
- --- a/apps/buffering.c
- +++ b/apps/buffering.c
- @@ -513,6 +513,35 @@ fill_buffer : Call buffer_handle for all handles that have data to buffer
- These functions are used by the buffering thread to manage buffer space.
- */
- +void update_data_counters(void);
- +
- +static inline bool buffer_is_low(void)
- +{
- + update_data_counters();
- + return data_counters.useful < BUFFERING_CRITICAL_LEVEL;
- +}
- +
- +/* Yield to the codec thread for as long as possible if it is in need of data.
- + Return true if the caller should break to let the buffering thread process
- + new queue events */
- +static bool yield_codec(void)
- +{
- + yield();
- +
- + if (!queue_empty(&buffering_queue))
- + return true;
- +
- + while (pcmbuf_is_lowdata() && !buffer_is_low())
- + {
- + sleep(2);
- + trigger_cpu_boost();
- +
- + if (!queue_empty(&buffering_queue))
- + return true;
- + }
- +
- + return false;
- +}
- /* Buffer data for the given handle.
- Return whether or not the buffering should continue explicitly. */
- @@ -596,20 +625,10 @@ static bool buffer_handle(int handle_id)
- h->available += rc;
- h->filerem -= rc;
- - yield();
- - /* If this is a large file, see if we need to breakor give the codec
- + /* If this is a large file, see if we need to break or give the codec
- * more time */
- - if (h->type==TYPE_PACKET_AUDIO) {
- - if (!queue_empty(&buffering_queue))
- - break;
- - if (pcmbuf_is_lowdata())
- - {
- - sleep(2);
- - trigger_cpu_boost();
- - if (!queue_empty(&buffering_queue))
- - break;
- - }
- - }
- + if (h->type==TYPE_PACKET_AUDIO && yield_codec())
- + break;
- }
- if (h->filerem == 0) {
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.