ZLMediaKit icon indicating copy to clipboard operation
ZLMediaKit copied to clipboard

[Feature Request] Requirement Description (Required)

Open linjiaqi2017 opened this issue 1 year ago • 20 comments

Describe the purpose of this feature, and provide relevant information to describe this feature

You can add the function of whether to support Hikvision or Dahua sdp stream pulling and conversion protocol

Is this feature used to improve project defects? If so, please describe the existing defects

You can add a way to pull streams

Describe how you expect to achieve this feature and the final effect

Support Hikvision or Dahua sdp stream pulling and conversion protocol to use other protocols for broadcasting

描述该功能的用处,可以提供相关资料描述该功能

可以添加是否支持海康或者大华sdp取流后转化协议的功能

该功能是否用于改进项目缺陷,如果是,请描述现有缺陷

可以增加一种取流的方式

描述你期望实现该功能的方式和最终效果

支持海康或者大华sdp取流后转化协议使用其他协议播的功能

TRANS_BY_GITHUB_AI_ASSISTANT

linjiaqi2017 avatar Sep 23 '24 09:09 linjiaqi2017

sdp -> sdk ?

xia-chu avatar Sep 23 '24 09:09 xia-chu

sdk, 上面写错了,是sdk

linjiaqi2017 avatar Sep 24 '24 07:09 linjiaqi2017

Our company is planning to implement a Dahua SDK stream pulling feature. I modified the deviceHK class you made public in the tests, changing it to deviceDH, which also inherits from the deviceChannel class. However, after integration, I found that the callback decoding to YUV and then re-encoding to H.264 crashes, temporarily crashing on line 134 of device.cpp. 批注 2024-09-19 141533 I suspect that the deviceDH class may not have overloaded this function, and I'm not sure what else needs to be modified. Can you help me take a look? I'm not familiar with the following points in zlmediakit: the call flow (those overloaded functions) and ZLToolKit

这边公司打算做一个大华sdk 取流的功能。我根据你在tests里面公开的海康sdk里面那个那个类deviceHK修改了一下,改成大华deviceDH 都是继承devicechannnel那个类。但是做集成后,发现回掉过来解码成yuv 然后再编码成h264就崩溃了,暂时崩溃在device.cpp 134行 批注 2024-09-19 141533 我感觉可能是deviceDH类的没有重载这个函数,不知道还需要修改哪,可以帮忙看看吗? zlmediakit 不熟悉的点是调用流程 (那些重载函数)和ZLToolKit

TRANS_BY_GITHUB_AI_ASSISTANT

linjiaqi2017 avatar Sep 24 '24 08:09 linjiaqi2017

Excuse me, could you help take a look at this problem?

请问一下可以帮忙看看这个问题吗

TRANS_BY_GITHUB_AI_ASSISTANT

linjiaqi2017 avatar Sep 25 '24 09:09 linjiaqi2017

Do you compile with x264 and faac on?

你编译时 开 x264和faac没

TRANS_BY_GITHUB_AI_ASSISTANT

xia-chu avatar Sep 26 '24 03:09 xia-chu

Compilation has started with x264 and faac. Now it's crashing in device.cpp in the initvideo function, in the addtrack function, you can try debugging the devicehk in the tests directory. In theory, it should produce the same result.

编译已经开启了 开 x264和faac. 现在是崩溃在device.cpp initvideo 里面的addtrack这个函数,你那边可以尝试调试一下tests目录下面的 devicehk 试试。按理来说会出现相同的现象。 device.h和cpp使用common 目录下面的

TRANS_BY_GITHUB_AI_ASSISTANT

linjiaqi2017 avatar Sep 26 '24 03:09 linjiaqi2017

Actually, during the debugging process, it was found that addTrack is a rewritten virtual function, and I'm not sure if it's possible that it should call addTrack from which class inheritance hierarchy. There is also the SDK's stream fetching and protocol stream fetching in ZLMediaKit. In the previous process, some initializations were not quite the same, I seem to have seen MediaSourceEvent For rewritten virtual functions like addTrack, if the code is modified to specify MultiMediaSourceMuxer::addTrack, it will not crash. However, whether the business logic is normal is hard to say. This MultiMediaSourceMuxer::addTrack no longer crashes, but the next inputFrame crashes.

其实调试的过程发现 addtrack 是一个重写的虚函数,不知道有没有可能是应该调用哪一个类继承体系的addTrack. 还有sdk取流和协议取流ZLmediakit 流程上之前一些初始化是不是不大一样,我好像看到那个MediaSourceEvent 像addtrack这种 重写的虚函数,如果代码修改指定MultiMediaSourceMuxer::addtrack, 不会崩溃。但是业务是否正常就不好说了。这个MultiMediaSourceMuxer::addtrack不崩溃了,下一个inputFrame就崩溃了

TRANS_BY_GITHUB_AI_ASSISTANT

linjiaqi2017 avatar Sep 27 '24 01:09 linjiaqi2017

I don't quite understand the part about the thread, specifically the getOwnerPoller, and also the MediaSourceEvent, these two places

我不大理解的地方是那个线程那个地方getOwnerPoller,还有MediaSourceEvent,还有那个strong_self和weak_self

TRANS_BY_GITHUB_AI_ASSISTANT

linjiaqi2017 avatar Sep 27 '24 02:09 linjiaqi2017

Excuse me, could you help take a look at this problem?

请问一下可以帮忙看看这个问题吗,或者找个时间一起看看也可以

TRANS_BY_GITHUB_AI_ASSISTANT

linjiaqi2017 avatar Sep 28 '24 12:09 linjiaqi2017

In the callback, the parameter captured by lambda is this? this may have been destroyed. You should use weak_ptr.

你在回调时 lambda捕获的参数是this? this可能都销毁了 你应该用weak_ptr

TRANS_BY_GITHUB_AI_ASSISTANT

xia-chu avatar Sep 29 '24 06:09 xia-chu

Specifically, which block of callback are you referring to? The Device.cpp file's DeviceChannel class?

具体说一下是哪一块的回调吗?Device.cpp 文件里面的devicechannel这个类吗 你是说这个吗? addTrack函数里面没有 lambda捕获

TRANS_BY_GITHUB_AI_ASSISTANT

linjiaqi2017 avatar Sep 29 '24 06:09 linjiaqi2017

image You accessed the DevChannel class in the callback, this class may have been destroyed, or other thread safety issues, this belongs to secondary development, we don't know how your code is written, so we can't assist you

image

你在回调中访问了DevChannel类,这个类可能已经析构掉了,或者其他线程安全问题,你这属于二次开发,你代码怎么写的我们也不知道,所以没法协助你

TRANS_BY_GITHUB_AI_ASSISTANT

xia-chu avatar Sep 29 '24 08:09 xia-chu

批注 2024-09-29 161653 批注 2024-09-29 161747 The code is written like this

批注 2024-09-29 161653 批注 2024-09-29 161747 代码是这么写

TRANS_BY_GITHUB_AI_ASSISTANT

linjiaqi2017 avatar Sep 29 '24 08:09 linjiaqi2017

This callback is the callback of the Dahua SDK, which is used to obtain the video stream. The first diagram illustrates the setting of the callback using the 'this' object, and the second one is the callback of the video frame and then calls the 'initVideo' function. This is the code, sorry for not pasting it earlier, very sorry, now I've added it.

这个回调是大华sdk的回调,回调出来视频流的,第一张图说明设置回调用了this 对象,第二个就是回调出来视频帧然后调用initVieo的函数。这个就是代码了,不好意思,之前没有粘贴,很抱歉,现在补上了

TRANS_BY_GITHUB_AI_ASSISTANT

linjiaqi2017 avatar Sep 29 '24 08:09 linjiaqi2017

I see you wrote before that Hai Kang is lambda capture, and static callback functions are the same, right?

我看你之前写的海康是 lambda捕获,静态回调函数也是一样吧

TRANS_BY_GITHUB_AI_ASSISTANT

linjiaqi2017 avatar Sep 29 '24 09:09 linjiaqi2017

I just changed to the same writing style as yours, Hai Kang, and it's the same too.

我刚才换成和你海康一样的写法了,测试也是一样的效果

TRANS_BY_GITHUB_AI_ASSISTANT

批注 2024-09-29 171004 批注 2024-09-29 171028

linjiaqi2017 avatar Sep 29 '24 09:09 linjiaqi2017

You're saying that the self needs to be changed to weak_ptr?

你是说那个 self 需要修改成weak_ptr吗

TRANS_BY_GITHUB_AI_ASSISTANT

linjiaqi2017 avatar Sep 29 '24 09:09 linjiaqi2017

I'm extremely sorry, but I need to trouble you again.

非常抱歉,还得再麻烦一下您

TRANS_BY_GITHUB_AI_ASSISTANT

linjiaqi2017 avatar Sep 29 '24 11:09 linjiaqi2017

Trouble you again when you have time

有时间再麻烦一下您

TRANS_BY_GITHUB_AI_ASSISTANT

linjiaqi2017 avatar Oct 02 '24 06:10 linjiaqi2017

Sorry, could you take another look, I've sent the code screenshot, sorry

不好意思,能麻烦您再看一下,代码截图发过来了,不好意思

TRANS_BY_GITHUB_AI_ASSISTANT

linjiaqi2017 avatar Oct 12 '24 06:10 linjiaqi2017

Sorry, could you take another look, I've sent the code screenshot, sorry

不好意思,能麻烦您再看一下,代码截图发过来了,不好意思

TRANS_BY_GITHUB_AI_ASSISTANT

linjiaqi2017 avatar Oct 21 '24 01:10 linjiaqi2017

@linjiaqi2017 I really can't analyze the bug of the secondary development, the code under the DeviceHK directory has not been maintained for a long time, and I don't know if it's feasible. Moreover, the code you sent can only see the tip of the iceberg. You can use valgrind to analyze it.

@linjiaqi2017 二次开发的bug 实在分析不了 ,DeviceHK目录下的代码早就没维护了,也不知道行不行。 而且你发的代码也只能管中窥豹。你用valgrind分析下吧

TRANS_BY_GITHUB_AI_ASSISTANT

xia-chu avatar Oct 21 '24 02:10 xia-chu