GithubHelp home page GithubHelp logo

Comments (31)

bropat avatar bropat commented on May 26, 2024 1

@fuatakgun I have implemented a debug option, try it and let me know.

from eufy-security-ws.

schliemann avatar schliemann commented on May 26, 2024 1

@bropat I will try and move the camera tonight. I will write when it is moved.

from eufy-security-ws.

fuatakgun avatar fuatakgun commented on May 26, 2024 1

Thanks for the update, let me know when i can test

from eufy-security-ws.

fuatakgun avatar fuatakgun commented on May 26, 2024 1

No, i mean it is working as expected now, so we can resolve the issue. So, all good. I just wanted to let you decide if you want to resolve or i can resolve it.

from eufy-security-ws.

bropat avatar bropat commented on May 26, 2024

@fuatakgun
Please always add or send me the debug logs of the driver.

In the concrete case it can be that a P2P error was reported (you would get by the event "command result" of the station).
That you got a result "true" for the command only means that the command was accepted by eufy-security-ws.
With the debug logs I can determine the exact cause and fix the error.

from eufy-security-ws.

fuatakgun avatar fuatakgun commented on May 26, 2024

I am new to docker / node thingy, how to generate debug logs?

from eufy-security-ws.

bropat avatar bropat commented on May 26, 2024

I just saw myself that an option to enable debug mode is missing in the docker container. Will add an option this weekend and report back here ;)

from eufy-security-ws.

fuatakgun avatar fuatakgun commented on May 26, 2024

I can switch to node based setup on demand, just tell me the arguments to enable debug logs with NPM or NODE.

from eufy-security-ws.

bropat avatar bropat commented on May 26, 2024

You just need to start the server (server.ts or server.js) with the -v (--verbose) option.

from eufy-security-ws.

bropat avatar bropat commented on May 26, 2024

@fuatakgun Any news about it?

from eufy-security-ws.

fuatakgun avatar fuatakgun commented on May 26, 2024

I tried new version and not able to start livestream for 2c cameras at all even though i used version 4. I should be missing one important thing but not able to find root cause

from eufy-security-ws.

bropat avatar bropat commented on May 26, 2024

I tried new version and not able to start livestream for 2c cameras at all even though i used version 4. I should be missing one important thing but not able to find root cause

I have discovered a bug in the new code that recognises the video codec. :(
I will fix it asap. Wait for release of eufy-security-client 1.1.1 ;)

from eufy-security-ws.

fuatakgun avatar fuatakgun commented on May 26, 2024

Thanks, i was going crazy to understand what i am missing :-)

from eufy-security-ws.

bropat avatar bropat commented on May 26, 2024

@fuatakgun

  • 2c pro fixed and working
  • 2c video works audio not => It looks like a different audio codec is being used here.

Thanks to @schliemann who gives me the opportunity to use his devices

from eufy-security-ws.

bropat avatar bropat commented on May 26, 2024

2c uses audiotype 7...

Found already the piece of code in Eufy:

if (zMp4Data.audioType == 7) {
    if (Mp4Mix.this.mAacDecode != null) {
        zMp4Data.data = Mp4Mix.this.mAacDecode.decode(zMp4Data.data, zMp4Data.len);
        zMp4Data.len = zMp4Data.data.length;
        bArr = Mp4Mix.this.accEncode(zMp4Data.data);
        if (bArr != null) {
            i = bArr.length;
        }
    }
} else if (zMp4Data.audioType == 1) {
    bArr = Mp4Mix.this.accEncode(zMp4Data.data);
    if (bArr != null) {
        i = bArr.length;
    }
} else {
    bArr = zMp4Data.data;
}

from eufy-security-ws.

bropat avatar bropat commented on May 26, 2024

Found the rest:

public class EldAacDecode implements BaseAacDecode {
    private static final int KEY_CHANNEL_COUNT = 1;
    private static final int KEY_SAMPLE_RATE = 16000;
    private int count = 0;
    private MediaCodec mDecoder;
    private ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

    public EldAacDecode() {
        try {
            this.mDecoder = MediaCodec.createDecoderByType("audio/mp4a-latm");
            this.outputStream = new ByteArrayOutputStream();
            MediaFormat mediaFormat = new MediaFormat();
            mediaFormat.setString(IMediaFormat.KEY_MIME, "audio/mp4a-latm");
            mediaFormat.setInteger("channel-count", 1);
            mediaFormat.setInteger("sample-rate", 16000);
            mediaFormat.setInteger(IjkMediaMeta.IJKM_KEY_BITRATE, 11025);
            mediaFormat.setInteger("is-adts", 0);
            mediaFormat.setInteger("aac-profile", 39);
            int[] iArr = {96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000};
            int i = -1;
            for (int i2 = 0; i2 < iArr.length; i2++) {
                if (iArr[i2] == 16000) {
                    i = i2;
                }
            }
            if (i != -1) {
                mediaFormat.setByteBuffer("csd-0", ByteBuffer.wrap(new byte[]{-8, -16, 48, 0}));
                this.mDecoder.configure(mediaFormat, (Surface) null, (MediaCrypto) null, 0);
                this.mDecoder.start();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override // com.oceanwing.battery.cam.zmedia.audio.BaseAacDecode
    public synchronized byte[] decode(byte[] bArr, int i) {
        if (this.mDecoder == null) {
            return null;
        }
        ByteBuffer[] inputBuffers = this.mDecoder.getInputBuffers();
        ByteBuffer[] outputBuffers = this.mDecoder.getOutputBuffers();
        try {
            int dequeueInputBuffer = this.mDecoder.dequeueInputBuffer(0);
            if (dequeueInputBuffer >= 0) {
                ByteBuffer byteBuffer = inputBuffers[dequeueInputBuffer];
                byteBuffer.clear();
                byteBuffer.put(bArr, 0, i);
                this.mDecoder.queueInputBuffer(dequeueInputBuffer, 0, i, 0, 0);
            }
            MediaCodec.BufferInfo bufferInfo = new MediaCodec.BufferInfo();
            int dequeueOutputBuffer = this.mDecoder.dequeueOutputBuffer(bufferInfo, 0);
            if (dequeueOutputBuffer < 0) {
                this.count++;
            }
            while (dequeueOutputBuffer >= 0) {
                ByteBuffer byteBuffer2 = outputBuffers[dequeueOutputBuffer];
                byte[] bArr2 = new byte[bufferInfo.size];
                byteBuffer2.get(bArr2);
                byteBuffer2.clear();
                this.outputStream.write(bArr2);
                this.mDecoder.releaseOutputBuffer(dequeueOutputBuffer, false);
                dequeueOutputBuffer = this.mDecoder.dequeueOutputBuffer(bufferInfo, 0);
            }
            byte[] byteArray = this.outputStream.toByteArray();
            try {
                this.outputStream.flush();
                this.outputStream.reset();
                return byteArray;
            } catch (IOException e) {
                e.printStackTrace();
                return null;
            }
        } catch (Exception e2) {
            e2.printStackTrace();
            return null;
        }
    }

from eufy-security-ws.

bropat avatar bropat commented on May 26, 2024

Strange sometimes the audioType for the 2c camera switches back to audioType 0 (AAC).

I'd say that's enough for today. ;)

@schliemann I'll let you know as soon as I no longer need the access. Thank you very much

from eufy-security-ws.

bropat avatar bropat commented on May 26, 2024

I think I understand why it selects a different audio type from time to time. It depends on the quality of the wifi signal.

@schliemann Can you please move the camera "Benjamin" for a short time so that it still has a very weak wifi signal but still works? Just move it further away from the station.

from eufy-security-ws.

fuatakgun avatar fuatakgun commented on May 26, 2024

One question, what has changed from previous version to new one in terms of audio codec?

from eufy-security-ws.

bropat avatar bropat commented on May 26, 2024

Nothing. Until now, I have only ever supported audio type 0.

from eufy-security-ws.

schliemann avatar schliemann commented on May 26, 2024

@bropat Moved Benjamin 2c to the edge of homebase coverage.

from eufy-security-ws.

bropat avatar bropat commented on May 26, 2024

@schliemann Thank you, but at the moment i can't reproduce the same behavior as yesterday. Actually the audio type is always 0 (AAC). :(

from eufy-security-ws.

bropat avatar bropat commented on May 26, 2024

@fuatakgun Try version 0.4.1 and let me know.

from eufy-security-ws.

bropat avatar bropat commented on May 26, 2024

@fuatakgun Any news about it?

from eufy-security-ws.

fuatakgun avatar fuatakgun commented on May 26, 2024

Back from vacation this week, i will keep you updated

from eufy-security-ws.

fuatakgun avatar fuatakgun commented on May 26, 2024

Tested with latest docker version;

2021-09-18 19:20:24 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - WebSocket message sent. {"messageId": "start_livesteam", "command": "device.start_livestream", "serialNumber": "T8113N63205014E2"}
2021-09-18 19:20:24 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - WebSocket message sent. {"messageId": "start_livesteam", "command": "device.start_livestream", "serialNumber": "T8113N63205018FC"}

2021-09-18 19:20:24 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - on_message - {'type': 'result', 'success': True, 'messageId': 'start_livesteam', 'result': {}}
2021-09-18 19:20:24 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - on_message - {'type': 'result', 'success': True, 'messageId': 'start_livesteam', 'result': {}}

2021-09-18 19:20:25 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - on_message - {'type': 'event', 'event': {'source': 'device', 'event': 'livestream started', 'serialNumber': 'T8113N63205018FC'}}

I did not receive any response for one of the requests, I believe, issue still exists.
On the other hand, I believe, this is a restriction of homebase, not the integration itself. On the app, I cannot even start two at the same time.

from eufy-security-ws.

bropat avatar bropat commented on May 26, 2024

@fuatakgun

There was an issue when several live streams from different devices of the same station were started one after the other over the same p2p connection. This has now been fixed and the "stop" event is triggered correctly (will be released with eufy-security-client 1.2.0).

Note: Only 1 stream can be active from a p2p session with the same station (eufy restriction). If you start another the previous is silently cancelled.

What is already supported in eufy-security-ws is that if several clients request a livestream of the same device, the livestream is started only once via eufy-security-client and eufy-security-ws takes care of duplicating the stream to the respective clients.

from eufy-security-ws.

bropat avatar bropat commented on May 26, 2024

@fuatakgun

Please check out new version and let me know.

from eufy-security-ws.

fuatakgun avatar fuatakgun commented on May 26, 2024

I confirm that livestream stopped event is generated for first stream when second stream was started. please resolve

from eufy-security-ws.

bropat avatar bropat commented on May 26, 2024

@fuatakgun Please attach debug logs

from eufy-security-ws.

bropat avatar bropat commented on May 26, 2024

@fuatakgun

I confirm that livestream stopped event is generated for first stream when second stream was started. please resolve

As already described above. That is the correct behaviour:

There was an issue when several live streams from different devices of the same station were started one after the other over the same p2p connection. This has now been fixed and the "stop" event is triggered correctly (will be released with eufy-security-client 1.2.0).

By please resolve do you mean I can close this issue? Or do you mean that this behaviour is not correct for you and I should change it? Which is not possible in this case, because it is an Eufy limitation...

from eufy-security-ws.

Related Issues (20)

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.