Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

yield_codec returns
Monday, November 5th, 2007 at 8:50:33pm UTC 

  1. diff --git a/apps/buffering.c b/apps/buffering.c
  2. index dcc753e..0fe6e5e 100644
  3. --- a/apps/buffering.c
  4. +++ b/apps/buffering.c
  5. @@ -513,6 +513,35 @@ fill_buffer     : Call buffer_handle for all handles that have data to buffer
  6.  These functions are used by the buffering thread to manage buffer space.
  7.  */
  8.  
  9. +void update_data_counters(void);
  10. +
  11. +static inline bool buffer_is_low(void)
  12. +{
  13. +    update_data_counters();
  14. +    return data_counters.useful < BUFFERING_CRITICAL_LEVEL;
  15. +}
  16. +
  17. +/* Yield to the codec thread for as long as possible if it is in need of data.
  18. +   Return true if the caller should break to let the buffering thread process
  19. +   new queue events */
  20. +static bool yield_codec(void)
  21. +{
  22. +    yield();
  23. +
  24. +    if (!queue_empty(&buffering_queue))
  25. +        return true;
  26. +
  27. +    while (pcmbuf_is_lowdata() && !buffer_is_low())
  28. +    {
  29. +        sleep(2);
  30. +        trigger_cpu_boost();
  31. +
  32. +        if (!queue_empty(&buffering_queue))
  33. +            return true;
  34. +    }
  35. +
  36. +    return false;
  37. +}
  38.  
  39.  /* Buffer data for the given handle.
  40.     Return whether or not the buffering should continue explicitly.  */
  41. @@ -596,20 +625,10 @@ static bool buffer_handle(int handle_id)
  42.          h->available += rc;
  43.          h->filerem -= rc;
  44.  
  45. -        yield();
  46. -        /* If this is a large file, see if we need to breakor give the codec
  47. +        /* If this is a large file, see if we need to break or give the codec
  48.           * more time */
  49. -        if (h->type==TYPE_PACKET_AUDIO) {
  50. -            if (!queue_empty(&buffering_queue))
  51. -                break;
  52. -            if (pcmbuf_is_lowdata())
  53. -            {
  54. -                sleep(2);
  55. -                trigger_cpu_boost();
  56. -                if (!queue_empty(&buffering_queue))
  57. -                    break;
  58. -            }
  59. -        }
  60. +        if (h->type==TYPE_PACKET_AUDIO && yield_codec())
  61. +            break;
  62.      }
  63.  
  64.      if (h->filerem == 0) {

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



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.

comments powered by Disqus
worth-right