diff mbox series

[FFmpeg-devel,v4] avformat/libsrt: print streamid at client

Message ID 20201006071807.1208359-1-raghavendra.rao@collabora.com
State New
Headers show
Series [FFmpeg-devel,v4] avformat/libsrt: print streamid at client | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Raghavendra Rao Sidlagatta Oct. 6, 2020, 7:18 a.m. UTC
Print the SRT streamid at the client.
Logged to info.

Signed-off-by: raghavendra <raghavendra.rao@collabora.com>
---
 libavformat/libsrt.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Raghavendra Rao Sidlagatta Oct. 6, 2020, 7:21 a.m. UTC | #1
Hello,

I believe that the stream id information should be logged to info instead of verbose as it contains important infor mation about the stream.

Regards,
Raghavendra Rao

On Tuesday, October 06, 2020 08:18 BST, raghavendra <raghavendra.rao@collabora.com> wrote:
 Print the SRT streamid at the client.
Logged to info.

Signed-off-by: raghavendra <raghavendra.rao@collabora.com>
---
libavformat/libsrt.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
index 4025b24976..eed48c11cf 100644
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -359,6 +359,13 @@ static int libsrt_set_options_pre(URLContext *h, int fd)
return 0;
}

+static void libsrt_dump_streamid(URLContext *h, int fd)
+{
+ char streamid[512];
+ int optlen = sizeof(streamid);
+ if (!libsrt_getsockopt(h, fd, SRTO_STREAMID, "SRTO_STREAMID", streamid, &optlen))
+ av_log(h, AV_LOG_INFO, "srt_streamid : %s\n", streamid);
+}

static int libsrt_setup(URLContext *h, const char *uri, int flags)
{
@@ -442,6 +449,8 @@ static int libsrt_setup(URLContext *h, const char *uri, int flags)
goto fail1;
listen_fd = fd;
fd = ret;
+ // dump srt streamid at client
+ libsrt_dump_streamid(h, fd);
} else {
if (s->mode == SRT_MODE_RENDEZVOUS) {
ret = srt_bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen);
--
2.25.1
Nicolas George Oct. 6, 2020, 7:38 a.m. UTC | #2
Raghavendra Rao Sidlagatta (12020-10-06):
> I believe that the stream id information should be logged to info instead of verbose as it contains important infor mation about the stream.

What can an end-user do with it?

Note: your MUA mangled the subject line.

Regards,
Raghavendra Rao Sidlagatta Oct. 6, 2020, 7:46 a.m. UTC | #3
Hello Nicolas,

I believe that the end user could retrieve the stream information and this could be handy in debugging as well.

Regards,
Raghavendra Rao

On Tuesday, October 06, 2020 08:38 BST, Nicolas George <george@nsup.org> wrote:
 Raghavendra Rao Sidlagatta (12020-10-06):
> I believe that the stream id information should be logged to info instead of verbose as it contains important infor mation about the stream.

What can an end-user do with it?

Note: your MUA mangled the subject line.

Regards,

--
Nicolas George
Nicolas George Oct. 6, 2020, 9:44 a.m. UTC | #4
Raghavendra Rao Sidlagatta (12020-10-06):
> I believe that the end user could retrieve the stream information

How?

> and this could be handy in debugging as well.

AV_LOG_DEBUG then.

> On Tuesday, October 06, 2020 08:38 BST, Nicolas George <george@nsup.org> wrote:

Don't top-post. If you don't know what it means, look it up.

Regards,
Raghavendra Rao Sidlagatta Jan. 20, 2021, 9:48 a.m. UTC | #5
On Tuesday, October 06, 2020 08:18 BST, raghavendra <raghavendra.rao@collabora.com> wrote:
 Print the SRT streamid at the client.
Logged to info.

Signed-off-by: raghavendra <raghavendra.rao@collabora.com>
---
libavformat/libsrt.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
index 4025b24976..eed48c11cf 100644
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -359,6 +359,13 @@ static int libsrt_set_options_pre(URLContext *h, int fd)
return 0;
}

+static void libsrt_dump_streamid(URLContext *h, int fd)
+{
+ char streamid[512];
+ int optlen = sizeof(streamid);
+ if (!libsrt_getsockopt(h, fd, SRTO_STREAMID, "SRTO_STREAMID", streamid, &optlen))
+ av_log(h, AV_LOG_INFO, "srt_streamid : %s\n", streamid);
+}

static int libsrt_setup(URLContext *h, const char *uri, int flags)
{
@@ -442,6 +449,8 @@ static int libsrt_setup(URLContext *h, const char *uri, int flags)
goto fail1;
listen_fd = fd;
fd = ret;
+ // dump srt streamid at client
+ libsrt_dump_streamid(h, fd);
} else {
if (s->mode == SRT_MODE_RENDEZVOUS) {
ret = srt_bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen);
--
2.25.1
Raghavendra Rao Sidlagatta March 22, 2021, 6:45 a.m. UTC | #6
On Wednesday, January 20, 2021 09:48 GMT, "Raghavendra Rao Sidlagatta" <raghavendra.rao@collabora.com> wrote:
  
On Tuesday, October 06, 2020 08:18 BST, raghavendra <raghavendra.rao@collabora.com> wrote:
 Print the SRT streamid at the client.
Logged to info.

Signed-off-by: raghavendra <raghavendra.rao@collabora.com>
---
libavformat/libsrt.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
index 4025b24976..eed48c11cf 100644
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -359,6 +359,13 @@ static int libsrt_set_options_pre(URLContext *h, int fd)
return 0;
}

+static void libsrt_dump_streamid(URLContext *h, int fd)
+{
+ char streamid[512];
+ int optlen = sizeof(streamid);
+ if (!libsrt_getsockopt(h, fd, SRTO_STREAMID, "SRTO_STREAMID", streamid, &optlen))
+ av_log(h, AV_LOG_INFO, "srt_streamid : %s\n", streamid);
+}

static int libsrt_setup(URLContext *h, const char *uri, int flags)
{
@@ -442,6 +449,8 @@ static int libsrt_setup(URLContext *h, const char *uri, int flags)
goto fail1;
listen_fd = fd;
fd = ret;
+ // dump srt streamid at client
+ libsrt_dump_streamid(h, fd);
} else {
if (s->mode == SRT_MODE_RENDEZVOUS) {
ret = srt_bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen);
--
2.25.1
Raghavendra Rao Sidlagatta July 23, 2021, 9:59 a.m. UTC | #7
On Monday, March 22, 2021 06:45 GMT, "Raghavendra Rao Sidlagatta" <raghavendra.rao@collabora.com> wrote:
  
On Wednesday, January 20, 2021 09:48 GMT, "Raghavendra Rao Sidlagatta" <raghavendra.rao@collabora.com> wrote:
  
On Tuesday, October 06, 2020 08:18 BST, raghavendra <raghavendra.rao@collabora.com> wrote:
 Print the SRT streamid at the client.
Logged to info.

Signed-off-by: raghavendra <raghavendra.rao@collabora.com>
---
libavformat/libsrt.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
index 4025b24976..eed48c11cf 100644
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -359,6 +359,13 @@ static int libsrt_set_options_pre(URLContext *h, int fd)
return 0;
}

+static void libsrt_dump_streamid(URLContext *h, int fd)
+{
+ char streamid[512];
+ int optlen = sizeof(streamid);
+ if (!libsrt_getsockopt(h, fd, SRTO_STREAMID, "SRTO_STREAMID", streamid, &optlen))
+ av_log(h, AV_LOG_INFO, "srt_streamid : %s\n", streamid);
+}

static int libsrt_setup(URLContext *h, const char *uri, int flags)
{
@@ -442,6 +449,8 @@ static int libsrt_setup(URLContext *h, const char *uri, int flags)
goto fail1;
listen_fd = fd;
fd = ret;
+ // dump srt streamid at client
+ libsrt_dump_streamid(h, fd);
} else {
if (s->mode == SRT_MODE_RENDEZVOUS) {
ret = srt_bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen);
--
2.25.1
Zhao Zhili July 23, 2021, 2 p.m. UTC | #8
> On Jul 23, 2021, at 5:59 PM, Raghavendra Rao Sidlagatta <raghavendra.rao@collabora.com> wrote:
> 
> 
> On Monday, March 22, 2021 06:45 GMT, "Raghavendra Rao Sidlagatta" <raghavendra.rao@collabora.com> wrote:
>   
> On Wednesday, January 20, 2021 09:48 GMT, "Raghavendra Rao Sidlagatta" <raghavendra.rao@collabora.com> wrote:
>   
> On Tuesday, October 06, 2020 08:18 BST, raghavendra <raghavendra.rao@collabora.com> wrote:
>  Print the SRT streamid at the client.
> Logged to info.
> 
> Signed-off-by: raghavendra <raghavendra.rao@collabora.com>
> ---
> libavformat/libsrt.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
> 
> diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
> index 4025b24976..eed48c11cf 100644
> --- a/libavformat/libsrt.c
> +++ b/libavformat/libsrt.c
> @@ -359,6 +359,13 @@ static int libsrt_set_options_pre(URLContext *h, int fd)
> return 0;
> }
> 
> +static void libsrt_dump_streamid(URLContext *h, int fd)
> +{
> + char streamid[512];
> + int optlen = sizeof(streamid);
> + if (!libsrt_getsockopt(h, fd, SRTO_STREAMID, "SRTO_STREAMID", streamid, &optlen))
> + av_log(h, AV_LOG_INFO, "srt_streamid : %s\n", streamid);
> +}

Sorry I didn’t notice your patch and have sent a similar one:

https://patchwork.ffmpeg.org/project/ffmpeg/patch/tencent_AE6202C169367CFAACEE39D9C15DB4A8690A@qq.com/

Please note that the array length of streamid should be 513. From the doc:
----
	• string - a C string. When setting an option, a const char* character array pointer is expected to be passed in optval and the array length in optlen without the terminating NULL character. When getting, an array is expected to be passed in optval with a sufficient size with an extra space for the terminating NULL character provided in optlen. The return value of optlen does not count the terminating NULL character.
----


> 
> static int libsrt_setup(URLContext *h, const char *uri, int flags)
> {
> @@ -442,6 +449,8 @@ static int libsrt_setup(URLContext *h, const char *uri, int flags)
> goto fail1;
> listen_fd = fd;
> fd = ret;
> + // dump srt streamid at client
> + libsrt_dump_streamid(h, fd);
> } else {
> if (s->mode == SRT_MODE_RENDEZVOUS) {
> ret = srt_bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen);
> --
> 2.25.1
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
> 
> Hello There,
> 
> Could you please let me know the upstream status of this patch?
> 
> Best Regards,
> Ragahvendra
>  
> 
> 
> Hello There,
> 
> Could you please let me know the upstream status of this patch?
> 
> Best Regards,
> Ragahvendra
> 
> Hello There,
> 
> Could you please let me know the upstream status of this patch?
> 
> Best Regards,
> Ragahvendra.
> 
>  
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Raghavendra Rao Sidlagatta Oct. 25, 2021, 10:39 a.m. UTC | #9
On Friday, July 23, 2021 10:59 BST, "Raghavendra Rao Sidlagatta" <raghavendra.rao@collabora.com> wrote:
  
On Monday, March 22, 2021 06:45 GMT, "Raghavendra Rao Sidlagatta" <raghavendra.rao@collabora.com> wrote:
  
On Wednesday, January 20, 2021 09:48 GMT, "Raghavendra Rao Sidlagatta" <raghavendra.rao@collabora.com> wrote:
  
On Tuesday, October 06, 2020 08:18 BST, raghavendra <raghavendra.rao@collabora.com> wrote:
 Print the SRT streamid at the client.
Logged to info.

Signed-off-by: raghavendra <raghavendra.rao@collabora.com>
---
libavformat/libsrt.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
index 4025b24976..eed48c11cf 100644
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -359,6 +359,13 @@ static int libsrt_set_options_pre(URLContext *h, int fd)
return 0;
}

+static void libsrt_dump_streamid(URLContext *h, int fd)
+{
+ char streamid[512];
+ int optlen = sizeof(streamid);
+ if (!libsrt_getsockopt(h, fd, SRTO_STREAMID, "SRTO_STREAMID", streamid, &optlen))
+ av_log(h, AV_LOG_INFO, "srt_streamid : %s\n", streamid);
+}

static int libsrt_setup(URLContext *h, const char *uri, int flags)
{
@@ -442,6 +449,8 @@ static int libsrt_setup(URLContext *h, const char *uri, int flags)
goto fail1;
listen_fd = fd;
fd = ret;
+ // dump srt streamid at client
+ libsrt_dump_streamid(h, fd);
} else {
if (s->mode == SRT_MODE_RENDEZVOUS) {
ret = srt_bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen);
--
2.25.1
Marton Balint Nov. 6, 2021, 7:42 p.m. UTC | #10
On Mon, 25 Oct 2021, Raghavendra Rao Sidlagatta wrote:

>
> On Friday, July 23, 2021 10:59 BST, "Raghavendra Rao Sidlagatta" <raghavendra.rao@collabora.com> wrote:
>   
> On Monday, March 22, 2021 06:45 GMT, "Raghavendra Rao Sidlagatta" <raghavendra.rao@collabora.com> wrote:
>   
> On Wednesday, January 20, 2021 09:48 GMT, "Raghavendra Rao Sidlagatta" <raghavendra.rao@collabora.com> wrote:
>   
> On Tuesday, October 06, 2020 08:18 BST, raghavendra <raghavendra.rao@collabora.com> wrote:
>  Print the SRT streamid at the client.
> Logged to info.
>
> Signed-off-by: raghavendra <raghavendra.rao@collabora.com>
> ---
> libavformat/libsrt.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
> index 4025b24976..eed48c11cf 100644
> --- a/libavformat/libsrt.c
> +++ b/libavformat/libsrt.c
> @@ -359,6 +359,13 @@ static int libsrt_set_options_pre(URLContext *h, int fd)
> return 0;
> }
>
> +static void libsrt_dump_streamid(URLContext *h, int fd)
> +{
> + char streamid[512];
> + int optlen = sizeof(streamid);
> + if (!libsrt_getsockopt(h, fd, SRTO_STREAMID, "SRTO_STREAMID", streamid, &optlen))
> + av_log(h, AV_LOG_INFO, "srt_streamid : %s\n", streamid);
> +}
>
> static int libsrt_setup(URLContext *h, const char *uri, int flags)
> {
> @@ -442,6 +449,8 @@ static int libsrt_setup(URLContext *h, const char *uri, int flags)
> goto fail1;
> listen_fd = fd;
> fd = ret;
> + // dump srt streamid at client
> + libsrt_dump_streamid(h, fd);
> } else {
> if (s->mode == SRT_MODE_RENDEZVOUS) {
> ret = srt_bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen);
> --
> 2.25.1

Streamid is already dumped for listen mode. Does it make sense for other 
modes? If it does, then dumping it from listen mode should probably be 
removed. Also your patch does not follow existing coding style, e.g. 
use 4 spaces for identation.

Thanks,
Marton
diff mbox series

Patch

diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
index 4025b24976..eed48c11cf 100644
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -359,6 +359,13 @@  static int libsrt_set_options_pre(URLContext *h, int fd)
     return 0;
 }
 
+static void libsrt_dump_streamid(URLContext *h, int fd)
+{
+    char streamid[512];
+    int optlen = sizeof(streamid);
+    if (!libsrt_getsockopt(h, fd, SRTO_STREAMID, "SRTO_STREAMID", streamid, &optlen))
+        av_log(h, AV_LOG_INFO, "srt_streamid : %s\n", streamid);
+}
 
 static int libsrt_setup(URLContext *h, const char *uri, int flags)
 {
@@ -442,6 +449,8 @@  static int libsrt_setup(URLContext *h, const char *uri, int flags)
             goto fail1;
         listen_fd = fd;
         fd = ret;
+        // dump srt streamid at client
+        libsrt_dump_streamid(h, fd);
     } else {
         if (s->mode == SRT_MODE_RENDEZVOUS) {
             ret = srt_bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen);