Open mthespian opened 3 years ago
Even if it makes me seem rude, but I don't think this change should be made upstream into this library as is.
I have several problems with it:
0xDD
as a DMX start code is never mentioned in the document.output.py
and output_thread.py
) it should also be implemented on the receiving side (receiver.py
and receiver_thread.py
) (might be a future step; minor issue).INTERVAL_CORRECTION_FACTOR = 0.984
come from? Could you provide a link or resource which explains this value?Keep in mind that I am not against the core idea behind this pull request (implementing per-channel priority), but I would do it differently.
I suggest a couple of things:
data_packet.py
, since this fixes a long standing issue, I would like to merge it.0xDD
start code packets by creating a separate class (potentialy inheriting Output
), although I am not quite sure about the changes to the OutputThread
; maybe a second separate class?I don't consider your response rude at all. Thank you for the suggestions and pointers.
A few responses:
Regarding item 4 above, I'm curious about the choices to calculate target multicast address and to set the multicast socket options on every packet.
I'll look at the data_packet fixups as a separate pull-request as you suggest. Past that one, would you be interested in a separate pull request to clean up a bunch of flake 8 warnings?
Thank you for your thoughts.
On Mon, Mar 8, 2021 at 11:17 AM Hundemeier notifications@github.com wrote:
Even if it makes me seem rude, but I don't think this change should be made upstream into this library as is.
I have several problems with it:
- It includes features outside of the scope of the ANSI E1.31 protocol https://tsp.esta.org/tsp/documents/docs/ANSI_E1-31-2018.pdf. Note that the value 0xDD as a DMX start code is never mentioned in the document.
- I think the current implementation violates the separation of concerns https://en.wikipedia.org/wiki/Separation_of_concerns principle. The current implementation of sender and receiver are limited to features directly mentioned in the E1.31 protocol document and I would like to keep it that way.
- If the functionality to send out specific priority information is implemented on the sender (output.py and output_thread.py) it should also be implemented on the receiving side (receiver.py and receiver_thread.py) (might be a future step; minor issue).
- Where does the value of INTERVAL_CORRECTION_FACTOR = 0.984 come from? Could you provide a link or resource which explains this value?
Keep in mind that I am not against the core idea behind this pull request (implementing per-channel priority), but I would do it differently.
I suggest a couple of things:
- Create a separate pull request for your changes on data_packet.py, since this fixes a long standing issue, I would like to merge it.
- Separate the handling of 0xDD start code packets by creating a separate class (potentialy inheriting Output), although I am not quite sure about the changes to the OutputThread; maybe a second separate class?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Hundemeier/sacn/pull/26#issuecomment-792916031, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHRDGJPWDH5QBWVM2NJ2KTTCUBCJANCNFSM4YYIOTKQ .
- E1.31 allows for alternate start codes ...
Thanks for the additional resources! Since I never heared of the start code 0xDD
before, I surely will read and try to understand the described steps by ETC.
- I considered additional classes ...
Quite a difficult problem to tackle, I will think about that one for a couple of days and hope I get a good idea for this. Otherwise the current approach might be the pragmatic one.
- I had left the receiver side as a separate future step. ...
I'm with you on that one. I think this should only be implemented in the future if needed.
- I knew someone was going to ...
I still need to understand the 0xDD
intricacies, but line 69ff in output_thread.py
might be interesting? Would it be possible to define a "fps" count for those specific packets?
- Would you be averse to putting the calculated target into data_packet?
I'm not sure I can follow you, but there is already a method for calculating the multicast target address via the universe in data_packet.py
line 167ff.
It seems we set the multicast options on every send operation. Is that necessary?
I think there is no other choice. If i remember correctly only one socket per port can be created, and if a packet requires specific settings, they need to be set before the send operation. I don't think this is a performance critical part in the process, otherwise it would have probably been addressed in #25 .
Past that one, would you be interested in a separate pull request to clean up a bunch of flake 8 warnings?
If you mean warnings in the master branch: of course! If the changes are only relevant for this branch, keep it here for now.
Great thank you! I'll be getting the data_packet cleanup ready for you in the next day or so.
I'm asking about the choice to calculate the multicast address on every send iteration. If that value was calculated when the universe property was set, we could store it and just retrieve it on send. Bit operations aren't super expensive, but reading a stored variable would be faster. Since a universe number rarely changes, you're trading a tiny amount of extra stored data for potentially 60-120 bit operations and string substitutions a second.
If we chose to store it, we could either add it into data_packet, or put it into output. But applying it in output suggests a need to bring target universe up into the output class so we can update the multicast destination when the universe changes.
About the socket options: I'm not seeing them ever unset anywhere. Once applied to the socket, don't they stay? Must they be reasserted before each output packet?
On Mon, Mar 8, 2021 at 3:38 PM Hundemeier notifications@github.com wrote:
- E1.31 allows for alternate start codes ...
Thanks for the additional resources! Since I never heared of the start code 0xDD before, I surely will read and try to understand the described steps by ETC.
- I considered additional classes ...
Quite a difficult problem to tackle, I will think about that one for a couple of days and hope I get a good idea for this. Otherwise the current approach might be the pragmatic one.
- I had left the receiver side as a separate future step. ...
I'm with you on that one. I think this should only be implemented in the future if needed.
- I knew someone was going to ...
I still need to understand the 0xDD intricacies, but line 69ff in output_thread.py https://github.com/Hundemeier/sacn/blob/a25b6bef85e09653224b828a70c6c3ebc7418e2e/sacn/sending/output_thread.py#L69 might be interesting? Would it be possible to define a "fps" count for those specific packets?
- Would you be averse to putting the calculated target into data_packet?
I'm not sure I can follow you, but there is already a method for calculating the multicast target address via the universe in data_packet.py line 167ff https://github.com/Hundemeier/sacn/blob/a25b6bef85e09653224b828a70c6c3ebc7418e2e/sacn/messages/data_packet.py#L167 .
It seems we set the multicast options on every send operation. Is that necessary?
I think there is no other choice. If i remember correctly only one socket per port can be created, and if a packet requires specific settings, they need to be set before the send operation. I don't think this is a performance critical part in the process, otherwise it would have probably been addressed in #25 https://github.com/Hundemeier/sacn/pull/25 .
Past that one, would you be interested in a separate pull request to clean up a bunch of flake 8 warnings?
If you mean warnings in the master branch: of course! If the changes are only relevant for this branch, keep it here for now.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Hundemeier/sacn/pull/26#issuecomment-793098610, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHRDGLYTJH3PSNGB54XBLDTCU7XBANCNFSM4YYIOTKQ .
If you are still up for it, you could now integrate your changes into the new sending implementation. I suggest inheriting from output.py
, sender.py
and sender_handler.py
.
This should be feasible now, as you can now "hook" into the sending loop of the sender by inheriting from SenderHandler
and overriding on_periodic_callback
while also calling the parent super().on_periodic_callback
implementation.
About the socket options: I'm not seeing them ever unset anywhere. Once applied to the socket, don't they stay? Must they be reasserted before each output packet?
They should propably be reasserted before each output packet, but this actually should only apply to the TTL-setting.
Note: 0xDD packets are not sync-sensitive, so they do not manual flush