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

Mine
Saturday, October 27th, 2007 at 5:32:38pm UTC 

  1. diff --git a/apps/playback.c b/apps/playback.c
  2. index 2ac54e7..7168fa6 100644
  3. --- a/apps/playback.c
  4. +++ b/apps/playback.c
  5. @@ -2569,6 +2571,7 @@ static void low_buffer_callback(void)
  6.  
  7.  static void audio_fill_file_buffer(bool start_play, size_t offset)
  8.  {
  9. +    struct queue_event ev;
  10.      bool had_next_track = audio_next_track() != NULL;
  11.      bool continue_buffering;
  12.  
  13. @@ -2591,9 +2594,14 @@ static void audio_fill_file_buffer(bool start_play, size_t offset)
  14.          start_play = false;
  15.          offset = 0;
  16.          sleep(1);
  17. -        if (!queue_empty(&audio_queue)) {
  18. -            /* There's a message in the queue. break the loop to treat it,
  19. -               and go back to filling after that. */
  20. +        if (queue_peek(&audio_queue, &ev)) {
  21. +            if (ev.id != Q_AUDIO_FILL_BUFFER)
  22. +            {
  23. +                /* There's a message in the queue. break the loop to treat it,
  24. +                and go back to filling after that. */
  25. +                LOGFQUEUE("buffering > audio Q_AUDIO_FILL_BUFFER");
  26. +                queue_post(&audio_queue, Q_AUDIO_FILL_BUFFER, 0);
  27. +            }
  28.              break;
  29.          }
  30.      } while (continue_buffering);
  31. diff --git a/firmware/export/kernel.h b/firmware/export/kernel.h
  32. index a72e004..84613eb 100644
  33. --- a/firmware/export/kernel.h
  34. +++ b/firmware/export/kernel.h
  35. @@ -219,6 +219,7 @@ extern void queue_reply(struct event_queue *q, intptr_t retval);
  36.  extern bool queue_in_queue_send(struct event_queue *q);
  37.  #endif /* HAVE_EXTENDED_MESSAGING_AND_NAME */
  38.  extern bool queue_empty(const struct event_queue* q);
  39. +extern bool queue_peek(struct event_queue *q, struct queue_event *ev);
  40.  extern void queue_clear(struct event_queue* q);
  41.  extern void queue_remove_from_head(struct event_queue *q, long id);
  42.  extern int queue_count(const struct event_queue *q);
  43. diff --git a/firmware/id3.c b/firmware/id3.c
  44. index a3d6297..db19b81 100644
  45. --- a/firmware/id3.c
  46. +++ b/firmware/id3.c
  47. @@ -44,6 +44,9 @@
  48.  #include "replaygain.h"
  49.  #include "rbunicode.h"
  50.  
  51. +#undef DEBUGF
  52. +#define DEBUGF(...)
  53. +
  54.  /** Database of audio formats **/
  55.  const struct afmt_entry audio_formats[AFMT_NUM_CODECS] =
  56.  {
  57. diff --git a/firmware/kernel.c b/firmware/kernel.c
  58. index 006a06d..35f29e6 100644
  59. --- a/firmware/kernel.c
  60. +++ b/firmware/kernel.c
  61. @@ -537,6 +537,28 @@ bool queue_empty(const struct event_queue* q)
  62.      return ( q->read == q->write );
  63.  }
  64.  
  65. +bool queue_peek(struct event_queue *q, struct queue_event *ev)
  66. +{
  67. +    if (q->read == q->write)
  68. +         return false;
  69. +
  70. +    bool have_msg = false;
  71. +
  72. +    int oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL);
  73. +    corelock_lock(&q->cl);
  74. +
  75. +    if (q->read != q->write)
  76. +    {
  77. +        *ev = q->events[q->read & QUEUE_LENGTH_MASK];
  78. +        have_msg = true;
  79. +    }
  80. +
  81. +    corelock_unlock(&q->cl);
  82. +    set_irq_level(oldlevel);
  83. +
  84. +    return have_msg;
  85. +}
  86. +
  87.  void queue_clear(struct event_queue* q)
  88.  {
  89.      int oldlevel;
  90. diff --git a/uisimulator/sdl/kernel.c b/uisimulator/sdl/kernel.c
  91. index 96654d5..220d069 100644
  92. --- a/uisimulator/sdl/kernel.c
  93. +++ b/uisimulator/sdl/kernel.c
  94. @@ -405,6 +405,26 @@ bool queue_empty(const struct event_queue* q)
  95.      return ( q->read == q->write );
  96.  }
  97.  
  98. +bool queue_peek(struct event_queue *q, struct queue_event *ev)
  99. +{
  100. +    if (q->read == q->write)
  101. +         return false;
  102. +
  103. +    bool have_msg = false;
  104. +
  105. +    int oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL);
  106. +
  107. +    if (q->read != q->write)
  108. +    {
  109. +        *ev = q->events[q->read & QUEUE_LENGTH_MASK];
  110. +        have_msg = true;
  111. +    }
  112. +
  113. +    set_irq_level(oldlevel);
  114. +
  115. +    return have_msg;
  116. +}
  117. +
  118.  void queue_clear(struct event_queue* q)
  119.  {
  120.      int oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL);

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