eriksl / streamproxy

This stream proxy can replace the streamproxy, transtreamproxy and filestreamproxy on VU+ receiver. Care has been taken to always fetch all bufferend data, so the transcoding engine won't crash.
Other
11 stars 14 forks source link

new audiolanguage switch for filetranscoding #10

Closed anudanan closed 5 years ago

anudanan commented 5 years ago

these 3 commits are for audiolanguage selection of filetranscoding

I´ve reset my repro to your master and now there are 3 commits

  1. debugging changes
  2. language selection
  3. streamproxy.conf example

I hope now the files are ok for you

eriksl commented 5 years ago

I have added your code, with a few changes

And finally I left out this patch:

ConfigValue::ConfigValue(string in)
 {
    string_value = in;
-   int_value = Util::string_to_int(in);
+   if (in.length())
+       int_value = Util::string_to_int(in);
+   else
+       int_value = 0;
 }

I don't understand what it's good for. string_to_int will return -1 on an invalid conversion. If you need 0 instead, turn it into 0 explictly, but not here, because it will influence all integer configuration items and that's probably not what you want.

Thanks for sharing your contribution!

anudanan commented 5 years ago

Thanks.
I´ve done the changes in ConfigValue because I saw in the /var/log/message file after starting streamproxy process the following lines

Mar 2 13:17:30 Schlafzimmer user.warn streamproxy:streamproxy: config_map: audiolang = deu/0 Mar 2 13:17:30 Schlafzimmer user.warn streamproxy: streamproxy: config_map: auth = true/1 Mar 2 13:17:30 Schlafzimmer user.warn streamproxy: streamproxy: config_map: bframes = 0/0 Mar 2 13:17:30 Schlafzimmer user.warn streamproxy: streamproxy: config_map: bitrate = 4000/4000 Mar 2 13:17:30 Schlafzimmer user.warn streamproxy: streamproxy: config_map: foreground = false/0 Mar 2 13:17:30 Schlafzimmer user.warn streamproxy: streamproxy: config_map: group = /0 Mar 2 13:17:30 Schlafzimmer user.warn streamproxy: streamproxy: config_map: level = 3.1/3 Mar 2 13:17:30 Schlafzimmer user.warn streamproxy: streamproxy: config_map: listen:8002 = 1/1 Mar 2 13:17:30 Schlafzimmer user.warn streamproxy: streamproxy: config_map: listen:8013 = 1/1 Mar 2 13:17:30 Schlafzimmer user.warn streamproxy: streamproxy: config_map: profile = baseline/0 Mar 2 13:17:30 Schlafzimmer user.warn streamproxy: streamproxy: config_map: size = 720p/720 Mar 2 13:17:30 Schlafzimmer user.warn streamproxy: streamproxy: config_map: webifport = 80/80

But if for example the audiolang parameter is an empty string "" because the user has forgotten the value in streamproxy.conf then ConfigValue stores a random integer into the integer part of the configmap and the message file shows:

Mar 2 13:17:30 Schlafzimmer user.warn streamproxy:streamproxy: config_map: audiolang = /32409 Mar 2 13:17:30 Schlafzimmer user.warn streamproxy: streamproxy: config_map: auth = true/1 Mar 2 13:17:30 Schlafzimmer user.warn streamproxy: streamproxy: config_map: bframes = 0/0 Mar 2 13:17:30 Schlafzimmer user.warn streamproxy: streamproxy: config_map: bitrate = 4000/4000 Mar 2 13:17:30 Schlafzimmer user.warn streamproxy: streamproxy: config_map: foreground = false/0

This is happend in these lines https://github.com/eriksl/streamproxy/blob/e8ecbe2fd2745fab77701c4a5a3de1cdbca5461d/src/streamproxy.cpp#L208

and will be printed out in https://github.com/eriksl/streamproxy/blob/e8ecbe2fd2745fab77701c4a5a3de1cdbca5461d/src/streamproxy.cpp#L290

I think that is also with the other parameter if they are empty

So I have search a fix for empty strings to produce a zero int value and not a random value. For me the central methode to do that ist ConfigValue. I think it is only a fix for logging in the message file and not for the transcoding function itself. But I don´t know what it happend if a important value is not set

Bit

eriksl commented 5 years ago

The string_to_int should yield a -1 in that case (but apparently it doesn't). I will check it and fix it.

eriksl commented 5 years ago

I think what you're seeing is a -1 squashed to an unsighed int when printed. It's harmless but looks funny.

anudanan commented 5 years ago

That is possible. It is not important for the function of streamproxy