Giter Site home page Giter Site logo

lua-mumble's People

Contributors

asdfjkluiop avatar bkacjios avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

lua-mumble's Issues

hook onUserChannel() not called?

Hi,
i try to use the following hook from the readme to detect users joining my channel:

client:hook("OnUserChannel", function(event)
	--["user"]	= mumble.user user,
	--["actor"]	= mumble.user actor,
	--["from"]	= mumble.channel from,
	--["to"]	= mumble.channel to,
    print("OnUserChannel(): client joined channel: ", event.user.getName())
end)

However it never seems to fire?

I was curious and looked in the hooks example code, there the hook is missing.
Is it not implemented yet?

Question: timers and access to shared variable - lock needed?

Hi, I have a question regarding threads safety in lua-mumble timers.

โ“ What happens, if at the same time the hook adds/reads data, and the timer nils that table?
Will this work (because the reference to the table inside the timer is still valid), or do I need some sort of locking (if so, what exactly?)

Given I have a complex sharedTable table:

sharedTable = {
  1 = {
    name:"somename",
    lastUpdate:12345
  },
  2 = {...},
  ...
}

In the hook OnPluginData I add and manipulate entries to that table.

I want to regularly clean out entries not updated for a prolonged time and maintain the lastUpdate timestamp for that.
I also have a mumble.timer iterating over that table each 60 seconds. It will set stale entries to sharedTable[userID] = nil so they are deleted from the table.

Add plugin packets

Hello,
mumble-voip/mumble#3743 will introduce a new plugin framework and with that comes a new packet type in the protocol that allows plugins to communicate to each other.
It would be nice if this packet would be supported in the lua client lib.
Plugins can use the method to send arbitary data to each other via the server.
A hook call when such data is incoming would be good, as well as an function to send such data to other clients (via the server).

The protobuf definition is here:

message PluginDataTransmission {
	// The session ID of the client this message was sent from
	optional uint32 senderSession = 1;
	// The session IDs of the clients that should receive this message
	repeated uint32 receiverSessions = 2 [packed = true];
	// The data that is sent
	optional bytes data = 3;
	// The ID of the sent data. This will be used by plugins to check whether they will
	// process it or not
	optional string dataID = 4;
}

Stuttery Audio playback

I have the project working well, the chatbot features we need are fine, however we want a new music bot and i've gotten the functionality working, however the audio sometimes stutters, and it makes it a little awkward. Both while connecting to the server over a network, and while connecting internally.

Timer counter

After removing mumble.sleep and client:update functions how can I now make timer event to build some needed stuff? Thanks.

Hook:OnMessage

I just tried to implement a chat interface, based on received messages: https://github.com/bkacjios/lua-mumble#onmessage-mumbleclient-client-table-event

However, it seems that just the message gets set into the event table. users is always an empty table and actor nil:

client:hook("OnMessage", function(client, event)
    -- ["actor"]		= mumble.user actor,
    -- ["message"]		= String message,
    -- ["users"]		= Table users,
    -- ["channels"]	= Table channels
    print("OnMessage:client", client)
    pprint(client)
    print("OnMessage:event", event)
    pprint(event)
end)

Sending "test" in direct chat prints:

OnMessage:client        mumble.client: 0x41d3a428

OnMessage:event table: 0x41d39c08
{ 
  message = 'TEST',
  users = {} 
}

Played samples not audible after some time (client:transmit)

Hello,
i have a playback bot (https://github.com/hbeni/fgcom-mumble/blob/master/server/fgcom-radio-playback.bot.lua) that plays back samples previously recorded.

This works fine. Until it doesn't. My log at the terminal still shows samples that are processed and put into the client:transmit function. From the mumble client perspective it looks like the bot is not speaking.

What i can see is, when activating the debug output of the sample data, that the printed binary blob changes at the moment when the transmission stops working.
The samples to be played are fetched from a lua buffer variable, that gets filled if its empty.

It somehow looks like the content of the buffer is overwritten with "garbage/random not-sample-data" at a random point in time - possible memory corruption?

Implement pluginData sending function

With the hook OnPluginData we are capable of receiving plugins information.
I need to broadcast such plugin data from a bot of mine, so my plugin can make itself aware to the plugin and beeing handled properly.
Something along the lines of mumble.client:send(String dataID, String message, [Array tgtusers]) where tgtusers is optional and defaults to all clients connected to the server.

MumbleAPI.h defines this as following, if that helps:

/// Sends the provided data to the provided client(s). This kind of data can only be received by another plugin active
/// on that client. The sent data can be seen by any active plugin on the receiving client. Therefore the sent data
/// must not contain sensitive information or anything else that shouldn't be known by others.
///
/// @param callerID The ID of the plugin calling this function
/// @param connection The ID of the server-connection to send the data through (the server the given users are on)
/// @param users An array of user IDs to send the data to
/// @param userCount The size of the provided user-array
/// @param data The data that shall be sent as a String
/// @param dataLength The length of the data-string
/// @param dataID The ID of the sent data. This has to be used by the receiving plugin(s) to figure out what to do with
/// 	the data
/// @returns The error code. If everything went well, STATUS_OK will be returned.
mumble_error_t (PLUGIN_CALLING_CONVENTION *sendData)(plugin_id_t callerID, mumble_connection_t connection, mumble_userid_t *users, size_t userCount, const char *data, size_t dataLength, const char *dataID);

Private message event

OnMessage event don't react on incoming private text message. How I can catch it? Thanks.

Question: How to capture incoming audio stream?

Hello,
i'm not sure if i understand the API correctly, but it seems there is currently no way to capture audio streams form other users?

I want to build some recording bot that stores incoming audio to a file on disk, suitable for later playback trough lua-mumble (background is fgcom-mumble, i need this for the ATIS recording feature).
How can i do that?

It is impotant to somehow beeing able to distinguish between sending users, because there might be several users recording ATIS messages in parallel.

sendPluginData with list broken? `bad argument #3 to 'sendPluginData' (mumble.user expected, got table)`

Hi, i noticed the following issue: bad argument #3 to 'sendPluginData' (mumble.user expected, got table)

  • I have code that updates a global playback_targets variable. It builds a table containing mumble.user objects:
    updateAllChannelUsersforSend = function(cl)
      print("udpate channelusers")
      local ch = cl:getChannel(fgcom.channel)
      local users = ch:getUsers()
      playback_targets = {}
      print("ok: "..ch:getName())
      for k,v in pairs(users) do
          print("  k="..tostring(k).."v="..tostring(v))
          table.insert(playback_targets, v)
      end
    end
  • I have a function defined to send specific plugin data to that list:
    notifyUserdata = function(tgts)
      local msg = "CALLSIGN="..fgcom.callsign
      fgcom.dbg("Bot sets userdata: "..msg)
      client:sendPluginData("FGCOM:UPD_USR:0", msg, tgts)
    end

When invoking it, I get the error.
When inspecting using inspect module after the call to updateAllChannelUsersforSend , it prints indeed the populated table:

    updateAllChannelUsersforSend(client)
local inspect = require('inspect')
print(inspect(playback_targets));
    notifyUserdata(playback_targets)
udpate channelusers
ok: fgcom-mumble
  k=73v=mumble.user [73][D-EBHX]
  k=75v=mumble.user [75][FGCOM-Recorder]
  k=74v=mumble.user [74][FGCOM-Status]
{ <userdata 1>, <userdata 2>, <userdata 3> }
test/fgcom-fakepilot.bot.lua:194: bad argument #3 to 'sendPluginData' (mumble.user expected, got table)

Compilation error from duplicate packet_handler definitions

Clean make all leads to:

/usr/bin/ld: channel.o:(.rodata+0x0): multiple definition of `packet_handler'; audio.o:(.rodata+0x0): first defined here
/usr/bin/ld: channel.o:(.bss+0x0): multiple definition of `MUMBLE_CONNECTIONS'; audio.o:(.bss+0x0): first defined here
/usr/bin/ld: client.o:(.rodata+0x0): multiple definition of `packet_handler'; audio.o:(.rodata+0x0): first defined here
/usr/bin/ld: client.o:(.bss+0x0): multiple definition of `MUMBLE_CONNECTIONS'; audio.o:(.bss+0x0): first defined here
/usr/bin/ld: encoder.o:(.rodata+0x0): multiple definition of `packet_handler'; audio.o:(.rodata+0x0): first defined here
/usr/bin/ld: encoder.o:(.bss+0x0): multiple definition of `MUMBLE_CONNECTIONS'; audio.o:(.bss+0x0): first defined here
/usr/bin/ld: mumble.o:(.bss+0x0): multiple definition of `MUMBLE_CONNECTIONS'; audio.o:(.bss+0x0): first defined here
/usr/bin/ld: mumble.o:(.rodata+0x0): multiple definition of `packet_handler'; audio.o:(.rodata+0x0): first defined here
/usr/bin/ld: packet.o:(.data.rel.ro+0x0): multiple definition of `packet_handler'; audio.o:(.rodata+0x0): first defined here
/usr/bin/ld: packet.o:(.bss+0x0): multiple definition of `MUMBLE_CONNECTIONS'; audio.o:(.bss+0x0): first defined here
/usr/bin/ld: target.o:(.rodata+0x0): multiple definition of `packet_handler'; audio.o:(.rodata+0x0): first defined here
/usr/bin/ld: target.o:(.bss+0x0): multiple definition of `MUMBLE_CONNECTIONS'; audio.o:(.bss+0x0): first defined here
/usr/bin/ld: timer.o:(.rodata+0x0): multiple definition of `packet_handler'; audio.o:(.rodata+0x0): first defined here
/usr/bin/ld: timer.o:(.bss+0x0): multiple definition of `MUMBLE_CONNECTIONS'; audio.o:(.bss+0x0): first defined here
/usr/bin/ld: user.o:(.rodata+0x0): multiple definition of `packet_handler'; audio.o:(.rodata+0x0): first defined here
/usr/bin/ld: user.o:(.bss+0x0): multiple definition of `MUMBLE_CONNECTIONS'; audio.o:(.bss+0x0): first defined here
/usr/bin/ld: util.o:(.rodata+0x0): multiple definition of `packet_handler'; audio.o:(.rodata+0x0): first defined here
/usr/bin/ld: util.o:(.bss+0x0): multiple definition of `MUMBLE_CONNECTIONS'; audio.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status

which leads to rg packet_handler showing:

mumble.h:338:27:const Packet_Handler_Func packet_handler[NUM_PACKETS];
packet.c:1051:27:const Packet_Handler_Func packet_handler[27] = {

And looking at the git blame, it seems like the one in packet.c was very very recently added in
72c83f239c8307a59a322abd6bb5f0c9688c76b9

Which I would assume is the cause of the duplication?

Crash in timer.lua example script

With adding "mumble:loop()" at the end of "timer.lua" example and running, it crashes after first iteration after 15 seconds. Is it normal?

1
2
3
Stopping timer..
free(): invalid pointer

With empty "OnServerSync" hook the same:

local mumble = require("mumble")
local client = assert(mumble.connect("druha.su", 64738, "bot.pem", "bot.key"))
client:auth("Mumble-Bot")
client:hook("OnServerSync", function(event)
  print("tick")
end)
mumble.loop()

client:play() arguments?

So I know you don't support this anymore really, and it seems like you're making Lumble, to be better and whatnot, but I stumbled on this and wanted to use it. I got most of it down, but your documentation for client:play seems to be wrong unfortunately. mumble.client:play(String ogg file path) is the string you document, but giving it a direct path to the .ogg doesn't work, as it expects a number for arg #2.

Add sample speed informatin to OnUserSpeak() hook

Currently we have no samplespeed information in the event table passed to the hook OnUserSpeak.
Thus we need to guess it currently (0.02 secs spacing between samples for 48kHz samples).

As the speed can vary depending on the codec used and some other circumstances, this should be passed from mumble to the lua hook.

client.me object absent

local mumble = require("mumble")
local client = assert(mumble.connect("some.host", 64738, "bot.pem", "bot.key"))
client:auth("Test-Bot")
local user = client.me
print(user)

Result: nil value

(bot has connected to server and works)
How to get own client user object???

How to compile?

I know you probably don't have notifications for this and this is a stupid question but if i'm being honest, I have no idea how to compile this. I'm a Lua programmer, not a C programmer, gosh darnit.
I compiled protoc as necessary, moved the headers into the folder as needed, and then i just kept re running make and downloading any headers I needed after that it started throwing errors in the mumble.c and it said a bunch of packages were not found in the pkg-config-path environment variable.
Any chance you have some binaries for Windows or Linux on hand?

Ok, I've successfully compiled. I still think official binaries or comp instructions would be helpful, but I'm going to leave my process below in case anyone else wants to build this but doesn't know how. (instructions for Linux)
Clone the repository, and then use the command make or make -f makefile inside of the directory. It will start to tell you you're missing certain packages like protobuf-c or openssl or vorbis. Whenever it does that, do sudo apt-get install lib[package]-dev where [package] is what you were missing, so the first thing you'll probably run into is no protobuf-c/protobuf-c.h file. So you would do sudo apt-get install libprotobuf-c-dev . Just keep installing those packages and then makeing until it doesnt fail any more. Then you'll be able to require Mumble in Lua.

timer.c realloc(): invalid next size

Hi there,
thanks to your fabolous library, i was able to implement the server side bots for fgcom-mumble.

Now I wanted to implement some fake clients (code see here) that connect to mumble and perform average stuff so I can test load of the server given my plugin infrastructure.
Unfortunately, the bots abort at a random time, especially if load/bot count increases.

I spawn the bots with a shell script, and the limit seems to be about 10 bots, then they start dropping out, printing "realloc(): invalid next size" as their last words.

It looks like some memory corruption, at least what i have found on the internet (but i have no knowledge of such things).

I was able to capture one of such aborts using gdb, and it pointed me to timer.c, line 19 and mumble.c, line 341.

realloc(): invalid next size

Program received signal SIGABRT, Aborted.
0x00007ffff7c77781 in raise () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) 
(gdb) 
(gdb) where
#0  0x00007ffff7c77781 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff7c6155b in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007ffff7cba038 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#3  0x00007ffff7cc13da in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#4  0x00007ffff7cc548c in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#5  0x00007ffff7cc6426 in realloc () from /lib/x86_64-linux-gnu/libc.so.6
#6  0x000055555556130e in ?? ()
#7  0x000055555555e499 in ?? ()
#8  0x000055555555ee80 in ?? ()
#9  0x000055555555f0a4 in ?? ()
#10 0x000055555555e41e in ?? ()
#11 0x000055555555f26d in ?? ()
#12 0x000055555555c9a8 in lua_pcall ()
#13 0x00007ffff7bf3bd7 in mumble_lua_timer (loop=0x7ffff7854720, w_=0x555555600ce8, revents=256) at timer.c:19
#14 0x00007ffff7848633 in ev_invoke_pending () from /usr/lib/x86_64-linux-gnu/libev.so.4
#15 0x00007ffff784be71 in ev_run () from /usr/lib/x86_64-linux-gnu/libev.so.4
#16 0x00007ffff7bf22b3 in mumble_loop (l=0x5555555832a0) at mumble.c:341
#17 0x000055555555eb59 in ?? ()
#18 0x000055555556850d in ?? ()
#19 0x000055555555f0d5 in ?? ()
#20 0x000055555555e41e in ?? ()
#21 0x000055555555f26d in ?? ()
#22 0x000055555555c9a8 in lua_pcall ()
#23 0x000055555555aa3e in ?? ()
#24 0x000055555555b506 in ?? ()
#25 0x000055555555eb59 in ?? ()
#26 0x000055555555f0a4 in ?? ()
#27 0x000055555555e41e in ?? ()
#28 0x000055555555f26d in ?? ()
#29 0x000055555555ca37 in lua_cpcall ()
#30 0x000055555555a6c6 in ?? ()
#31 0x00007ffff7c62e0b in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6
#32 0x000055555555a74a in ?? ()

uninitialized error variable in client_play()

Hi,

It seems that error variable in client_play() (client.c) is not initialized and stb_vorbis_open_filename() in case of success does not change its value so that following error checking if statement works only by chance (on my setup it didn't work).

Simple solution:

-	int error;
+	int error = VORBIS__no_error;

Additionally I think there is possible memory leak in case of error in stb_vorbis_open_filename() - function returns without freeing the sound pointer.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.