Re: [Musicpd-dev-team] Tags in OGG httpd stream

2013-10-19 Thread Max Kellermann
On 2013/10/11 05:12, Ben Boeckel maths...@gmail.com wrote:
 the tag chunk is dropped because chunk-length is 0 for it. A patch
 which fixes the issue is attached.

Merged, thanks.  Sorry for letting you wait for so long.

--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60135031iu=/4140/ostg.clktrk
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


Re: [Musicpd-dev-team] Tags in OGG httpd stream

2013-10-19 Thread Ben Boeckel
On Sat, Oct 19, 2013 at 15:47:25 +0200, Max Kellermann wrote:
 On 2013/10/11 05:12, Ben Boeckel maths...@gmail.com wrote:
  the tag chunk is dropped because chunk-length is 0 for it. A patch
  which fixes the issue is attached.
 
 Merged, thanks.  Sorry for letting you wait for so long.

Thanks! No problem; I'm getting other patches through to get these tags
visible on the player end too (ffmpeg and mpv need patched; mplayer had
its own ogg decoder); quite the adventure!

--Ben

--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60135031iu=/4140/ostg.clktrk
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


Re: [Musicpd-dev-team] Tags in OGG httpd stream

2013-10-10 Thread Ben Boeckel
On Wed, Dec 05, 2012 at 16:51:54 -0500, Ben Boeckel wrote:
 @@ -524,31 +532,7 @@ decoder_replay_gain(struct decoder *decoder,
   float return_db = 0;
   assert(decoder != NULL);
  
 - if (replay_gain_info != NULL) {
 - static unsigned serial;
 - if (++serial == 0)
 - serial = 1;
 -
 - if (REPLAY_GAIN_OFF != replay_gain_mode) {
 - return_db = 20.0 * log10f(
 - replay_gain_tuple_scale(
 - 
 replay_gain_info-tuples[replay_gain_get_real_mode()],
 - replay_gain_preamp, 
 replay_gain_missing_preamp,
 - replay_gain_limit));
 - }
 -
 - decoder-replay_gain_info = *replay_gain_info;
 - decoder-replay_gain_serial = serial;
 -
 - if (decoder-chunk != NULL) {
 - /* flush the current chunk because the new
 -replay gain values affect the following
 -samples */
 - decoder_flush_chunk(decoder);

So this line here was the issue. This flushes the chunk into the stream
with just the tag and no data on it. Combined with this code right
before the chunk leaves for the sources:

static bool
play_chunk(player_control pc,
   Song *song, struct music_chunk *chunk,
   MusicBuffer buffer,
   const AudioFormat format,
   Error error)
{
assert(chunk-CheckFormat(format));

if (chunk-tag != nullptr)
update_song_tag(song, *chunk-tag);

if (chunk-length == 0) {
buffer.Return(chunk);
return true;
}

pc.Lock();
pc.bit_rate = chunk-bit_rate;
pc.Unlock();

/* send the chunk to the audio outputs */

if (!audio_output_all_play(chunk, error))
return false;

pc.total_play_time += (double)chunk-length /
format.GetTimeToSize();
return true;
}

the tag chunk is dropped because chunk-length is 0 for it. A patch
which fixes the issue is attached.

 - g_cond_signal(decoder-dc-client_cond);
 - }
 - } else
 - decoder-replay_gain_serial = 0;
 + replay_gain_state_set_info(decoder-replay_gain, replay_gain_info);

--Ben
From 9f7690767838052661160de5a30d28acc6ef3473 Mon Sep 17 00:00:00 2001
From: Ben Boeckel maths...@gmail.com
Date: Thu, 10 Oct 2013 23:00:52 -0400
Subject: [PATCH] PlayerThread: Only drop 0 length packets without tags

Fixes a regression from 752dfb3d95482c562e5d24c6ea839c4815de9a6d which
caused the current chunk to be flushed as soon as new replaygain
information was found. If this occurs on a tag chunk, it has no data
(length 0) and is then skipped before pushing it to all of the outputs.

This change allows 0-length chunks through if they contain a tag and
they are now appearing in mplayer and mpv properly.
---
 src/PlayerThread.cxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PlayerThread.cxx b/src/PlayerThread.cxx
index 9ad37ea..534a24e 100644
--- a/src/PlayerThread.cxx
+++ b/src/PlayerThread.cxx
@@ -726,7 +726,7 @@ play_chunk(player_control pc,
if (chunk-tag != nullptr)
update_song_tag(song, *chunk-tag);
 
-   if (chunk-length == 0) {
+   if (chunk-length == 0  chunk-tag == nullptr) {
buffer.Return(chunk);
return true;
}
-- 
1.8.3.1

--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60134071iu=/4140/ostg.clktrk___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


Re: [Musicpd-dev-team] Tags in OGG httpd stream

2013-10-10 Thread Ben Boeckel
On Thu, Oct 10, 2013 at 23:12:27 -0400, Ben Boeckel wrote:
 So this line here was the issue. This flushes the chunk into the stream
 with just the tag and no data on it. Combined with this code right
 before the chunk leaves for the sources:

It seems this fix isn't complete actually. It works properly if I do
'mpd next', but if the song changes as usual, the tags don't show up
again. This will have to wait until next week for me to dig in further.

--Ben

--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60134071iu=/4140/ostg.clktrk
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


Re: [Musicpd-dev-team] Tags in OGG httpd stream

2013-10-10 Thread Ben Boeckel
On Fri, Oct 11, 2013 at 00:14:46 -0400, Ben Boeckel wrote:
 On Thu, Oct 10, 2013 at 23:12:27 -0400, Ben Boeckel wrote:
  So this line here was the issue. This flushes the chunk into the stream
  with just the tag and no data on it. Combined with this code right
  before the chunk leaves for the sources:
 
 It seems this fix isn't complete actually. It works properly if I do
 'mpd next', but if the song changes as usual, the tags don't show up
 again. This will have to wait until next week for me to dig in further.

Or this is just me not checking mplayer, which is fine in both cases.
mpv/ffmpeg isn't seeing the new tags, which is a separate issue. Time
for bed if I'm missing this stuff...

--Ben

--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60134071iu=/4140/ostg.clktrk
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team