Realtime priority

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Realtime priority

Mathias Gyllengahm
Hi again,

I'd like to let my gstreamer process have realtime priority. I have tried to do it with prefix the whole thing with "chrt -r -p 99" but I get:

GThread-ERROR **: file /build/buildd/glib2.0-2.24.1/gthread/gthread-posix.c: line 348 (g_thread_create_posix_impl): error 'Invalid argument' during 'pthread_attr_setschedparam (&attr, &sched)'

Doing a chrt by pid afterwards has no effect at all. This is my pipeline, and it's clear that it has problems when cpu load goes up - and I'd like to avoid that. I've seen something about realtime priorities when it comes to using the API - but is there a way to do it when using gst-launch?

Thanks in advance,
/Mathias

/usr/local/bin/gst-launch-0.10 -v --gst-plugin-path=/usr/local/lib/gstreamer-0.10 \
    v4l2src \
    ! videorate \
    ! video/x-raw-yuv,width=320,height=240,framerate=15/1 \
    ! ffmpegcolorspace \
    ! x264enc bitrate=152 subme=4 b-pyramid=true weightb=true \
    ! queue2 \
    ! flvmux name=mux \
    alsasrc device=hw:0,0 \
    ! audio/x-raw-int,rate=22050,channels=2,depth=16 \
    ! audiorate \
    ! queue2 max-size-buffers=600 max-size-bytes=0 max-size-time=0 \
    ! audioconvert \
    ! lamemp3enc target=1 bitrate=40 mono=true encoding-engine-quality=1 target=bitrate \
    ! mux. mux. \
    ! queue2 \
    ! filesink location=outfile.flv sync=false


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Realtime priority

Michael Trimarchi
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi

On 02/22/2011 03:16 PM, Mathias Gyllengahm wrote:
> Hi again,
>
> I'd like to let my gstreamer process have realtime priority. I have tried to
> do it with prefix the whole thing with "chrt -r -p 99" but I get:
>
> GThread-ERROR **: file /build/buildd/glib2.0-2.24.1/gthread/gthread-posix.c:
> line 348 (g_thread_create_posix_impl): error 'Invalid argument' during
> 'pthread_attr_setschedparam (&attr, &sched)'
>

Use the examples inside the gstreamer source code directory. Thread rt pull

Michael Trimarchi

> Doing a chrt by pid afterwards has no effect at all. This is my pipeline,
> and it's clear that it has problems when cpu load goes up - and I'd like to
> avoid that. I've seen something about realtime priorities when it comes to
> using the API - but is there a way to do it when using gst-launch?
>
> Thanks in advance,
> /Mathias
>
> /usr/local/bin/gst-launch-0.10 -v
> --gst-plugin-path=/usr/local/lib/gstreamer-0.10 \
>     v4l2src \
>     ! videorate \
>     ! video/x-raw-yuv,width=320,height=240,framerate=15/1 \
>     ! ffmpegcolorspace \
>     ! x264enc bitrate=152 subme=4 b-pyramid=true weightb=true \
>     ! queue2 \
>     ! flvmux name=mux \
>     alsasrc device=hw:0,0 \
>     ! audio/x-raw-int,rate=22050,channels=2,depth=16 \
>     ! audiorate \
>     ! queue2 max-size-buffers=600 max-size-bytes=0 max-size-time=0 \
>     ! audioconvert \
>     ! lamemp3enc target=1 bitrate=40 mono=true encoding-engine-quality=1
> target=bitrate \
>     ! mux. mux. \
>     ! queue2 \
>     ! filesink location=outfile.flv sync=false
>
>
>
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNY8ZkAAoJEJJLw+x5tkpwySQH/29KPAimO9X8xR6FgDLpHn3w
3SQzLr8b55tiPhCM4c/PO3+qmCIj/jwfDPyAyYkQnFTrKsGHjTslzykCkLRHDohH
zKAc/m8bMGiDsCKI3++J6N1iVDSYTtLx72j0PrgpeMG7bbMmX2zpbKS15cjaD8IY
L61oo9ha+bSDuascHrr5wSk3lUpUDFzzaWGcGpcw+CmUxwRJbu4yHuK4hOXzg9So
bh8q/CI1lIJPVceqBs2zl+XyKh598Z5/wNISSL7cX6RXQbl+VhVAF2J8dxJxy4z1
UQVweHDUTKRHYtT4gOUN1QMNq4CyUuqSEg+97ql4Lh/exl5MhfeCwYMVrCGR/bA=
=up4s
-----END PGP SIGNATURE-----
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Realtime priority

Mathias Gyllengahm
Thanks for fast reply! Sorry, I'm not really sure which example you mean - and if it's applicable to gst-launch. I find ./tests/examples/streams/rtpool-test, but it's c-code and I'm not sure what to make of it...

BR,
Mathias


2011/2/22 Michael Trimarchi <[hidden email]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi

On 02/22/2011 03:16 PM, Mathias Gyllengahm wrote:
> Hi again,
>
> I'd like to let my gstreamer process have realtime priority. I have tried to
> do it with prefix the whole thing with "chrt -r -p 99" but I get:
>
> GThread-ERROR **: file /build/buildd/glib2.0-2.24.1/gthread/gthread-posix.c:
> line 348 (g_thread_create_posix_impl): error 'Invalid argument' during
> 'pthread_attr_setschedparam (&attr, &sched)'
>

Use the examples inside the gstreamer source code directory. Thread rt pull

Michael Trimarchi

> Doing a chrt by pid afterwards has no effect at all. This is my pipeline,
> and it's clear that it has problems when cpu load goes up - and I'd like to
> avoid that. I've seen something about realtime priorities when it comes to
> using the API - but is there a way to do it when using gst-launch?
>
> Thanks in advance,
> /Mathias
>
> /usr/local/bin/gst-launch-0.10 -v
> --gst-plugin-path=/usr/local/lib/gstreamer-0.10 \
>     v4l2src \
>     ! videorate \
>     ! video/x-raw-yuv,width=320,height=240,framerate=15/1 \
>     ! ffmpegcolorspace \
>     ! x264enc bitrate=152 subme=4 b-pyramid=true weightb=true \
>     ! queue2 \
>     ! flvmux name=mux \
>     alsasrc device=hw:0,0 \
>     ! audio/x-raw-int,rate=22050,channels=2,depth=16 \
>     ! audiorate \
>     ! queue2 max-size-buffers=600 max-size-bytes=0 max-size-time=0 \
>     ! audioconvert \
>     ! lamemp3enc target=1 bitrate=40 mono=true encoding-engine-quality=1
> target=bitrate \
>     ! mux. mux. \
>     ! queue2 \
>     ! filesink location=outfile.flv sync=false
>
>
>
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNY8ZkAAoJEJJLw+x5tkpwySQH/29KPAimO9X8xR6FgDLpHn3w
3SQzLr8b55tiPhCM4c/PO3+qmCIj/jwfDPyAyYkQnFTrKsGHjTslzykCkLRHDohH
zKAc/m8bMGiDsCKI3++J6N1iVDSYTtLx72j0PrgpeMG7bbMmX2zpbKS15cjaD8IY
L61oo9ha+bSDuascHrr5wSk3lUpUDFzzaWGcGpcw+CmUxwRJbu4yHuK4hOXzg9So
bh8q/CI1lIJPVceqBs2zl+XyKh598Z5/wNISSL7cX6RXQbl+VhVAF2J8dxJxy4z1
UQVweHDUTKRHYtT4gOUN1QMNq4CyUuqSEg+97ql4Lh/exl5MhfeCwYMVrCGR/bA=
=up4s
-----END PGP SIGNATURE-----
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Realtime priority

Mathias Gyllengahm
So... it's not possible with realtime priority when using gst-launch today? Is that the conclusion?
/Mathias

2011/2/22 Mathias Gyllengahm <[hidden email]>
Thanks for fast reply! Sorry, I'm not really sure which example you mean - and if it's applicable to gst-launch. I find ./tests/examples/streams/rtpool-test, but it's c-code and I'm not sure what to make of it...

BR,
Mathias


2011/2/22 Michael Trimarchi <[hidden email]>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi

On 02/22/2011 03:16 PM, Mathias Gyllengahm wrote:
> Hi again,
>
> I'd like to let my gstreamer process have realtime priority. I have tried to
> do it with prefix the whole thing with "chrt -r -p 99" but I get:
>
> GThread-ERROR **: file /build/buildd/glib2.0-2.24.1/gthread/gthread-posix.c:
> line 348 (g_thread_create_posix_impl): error 'Invalid argument' during
> 'pthread_attr_setschedparam (&attr, &sched)'
>

Use the examples inside the gstreamer source code directory. Thread rt pull

Michael Trimarchi

> Doing a chrt by pid afterwards has no effect at all. This is my pipeline,
> and it's clear that it has problems when cpu load goes up - and I'd like to
> avoid that. I've seen something about realtime priorities when it comes to
> using the API - but is there a way to do it when using gst-launch?
>
> Thanks in advance,
> /Mathias
>
> /usr/local/bin/gst-launch-0.10 -v
> --gst-plugin-path=/usr/local/lib/gstreamer-0.10 \
>     v4l2src \
>     ! videorate \
>     ! video/x-raw-yuv,width=320,height=240,framerate=15/1 \
>     ! ffmpegcolorspace \
>     ! x264enc bitrate=152 subme=4 b-pyramid=true weightb=true \
>     ! queue2 \
>     ! flvmux name=mux \
>     alsasrc device=hw:0,0 \
>     ! audio/x-raw-int,rate=22050,channels=2,depth=16 \
>     ! audiorate \
>     ! queue2 max-size-buffers=600 max-size-bytes=0 max-size-time=0 \
>     ! audioconvert \
>     ! lamemp3enc target=1 bitrate=40 mono=true encoding-engine-quality=1
> target=bitrate \
>     ! mux. mux. \
>     ! queue2 \
>     ! filesink location=outfile.flv sync=false
>
>
>
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNY8ZkAAoJEJJLw+x5tkpwySQH/29KPAimO9X8xR6FgDLpHn3w
3SQzLr8b55tiPhCM4c/PO3+qmCIj/jwfDPyAyYkQnFTrKsGHjTslzykCkLRHDohH
zKAc/m8bMGiDsCKI3++J6N1iVDSYTtLx72j0PrgpeMG7bbMmX2zpbKS15cjaD8IY
L61oo9ha+bSDuascHrr5wSk3lUpUDFzzaWGcGpcw+CmUxwRJbu4yHuK4hOXzg9So
bh8q/CI1lIJPVceqBs2zl+XyKh598Z5/wNISSL7cX6RXQbl+VhVAF2J8dxJxy4z1
UQVweHDUTKRHYtT4gOUN1QMNq4CyUuqSEg+97ql4Lh/exl5MhfeCwYMVrCGR/bA=
=up4s
-----END PGP SIGNATURE-----
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Realtime priority

Michael Trimarchi
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi

On 02/23/2011 09:02 AM, Mathias Gyllengahm wrote:
> So... it's not possible with realtime priority when using gst-launch today?
> Is that the conclusion?

no, this is not. You can use schedtool and call for each pids of the application threads or write
a little application that do the same using the gst_parse_launch

Michael

> /Mathias
>
> 2011/2/22 Mathias Gyllengahm <[hidden email]>
>
>> Thanks for fast reply! Sorry, I'm not really sure which example you mean -
>> and if it's applicable to gst-launch. I find
>> ./tests/examples/streams/rtpool-test, but it's c-code and I'm not sure what
>> to make of it...
>>
>> BR,
>> Mathias
>>
>>
>> 2011/2/22 Michael Trimarchi <[hidden email]>
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA1
>>>
>>> Hi
>>>
>>> On 02/22/2011 03:16 PM, Mathias Gyllengahm wrote:
>>>> Hi again,
>>>>
>>>> I'd like to let my gstreamer process have realtime priority. I have
>>> tried to
>>>> do it with prefix the whole thing with "chrt -r -p 99" but I get:
>>>>
>>>> GThread-ERROR **: file
>>> /build/buildd/glib2.0-2.24.1/gthread/gthread-posix.c:
>>>> line 348 (g_thread_create_posix_impl): error 'Invalid argument' during
>>>> 'pthread_attr_setschedparam (&attr, &sched)'
>>>>
>>>
>>> Use the examples inside the gstreamer source code directory. Thread rt
>>> pull
>>>
>>> Michael Trimarchi
>>>
>>>> Doing a chrt by pid afterwards has no effect at all. This is my
>>> pipeline,
>>>> and it's clear that it has problems when cpu load goes up - and I'd like
>>> to
>>>> avoid that. I've seen something about realtime priorities when it comes
>>> to
>>>> using the API - but is there a way to do it when using gst-launch?
>>>>
>>>> Thanks in advance,
>>>> /Mathias
>>>>
>>>> /usr/local/bin/gst-launch-0.10 -v
>>>> --gst-plugin-path=/usr/local/lib/gstreamer-0.10 \
>>>>     v4l2src \
>>>>     ! videorate \
>>>>     ! video/x-raw-yuv,width=320,height=240,framerate=15/1 \
>>>>     ! ffmpegcolorspace \
>>>>     ! x264enc bitrate=152 subme=4 b-pyramid=true weightb=true \
>>>>     ! queue2 \
>>>>     ! flvmux name=mux \
>>>>     alsasrc device=hw:0,0 \
>>>>     ! audio/x-raw-int,rate=22050,channels=2,depth=16 \
>>>>     ! audiorate \
>>>>     ! queue2 max-size-buffers=600 max-size-bytes=0 max-size-time=0 \
>>>>     ! audioconvert \
>>>>     ! lamemp3enc target=1 bitrate=40 mono=true encoding-engine-quality=1
>>>> target=bitrate \
>>>>     ! mux. mux. \
>>>>     ! queue2 \
>>>>     ! filesink location=outfile.flv sync=false
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> gstreamer-devel mailing list
>>>> [hidden email]
>>>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>>
>>> -----BEGIN PGP SIGNATURE-----
>>> Version: GnuPG v1.4.10 (GNU/Linux)
>>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>>>
>>> iQEcBAEBAgAGBQJNY8ZkAAoJEJJLw+x5tkpwySQH/29KPAimO9X8xR6FgDLpHn3w
>>> 3SQzLr8b55tiPhCM4c/PO3+qmCIj/jwfDPyAyYkQnFTrKsGHjTslzykCkLRHDohH
>>> zKAc/m8bMGiDsCKI3++J6N1iVDSYTtLx72j0PrgpeMG7bbMmX2zpbKS15cjaD8IY
>>> L61oo9ha+bSDuascHrr5wSk3lUpUDFzzaWGcGpcw+CmUxwRJbu4yHuK4hOXzg9So
>>> bh8q/CI1lIJPVceqBs2zl+XyKh598Z5/wNISSL7cX6RXQbl+VhVAF2J8dxJxy4z1
>>> UQVweHDUTKRHYtT4gOUN1QMNq4CyUuqSEg+97ql4Lh/exl5MhfeCwYMVrCGR/bA=
>>> =up4s
>>> -----END PGP SIGNATURE-----
>>> _______________________________________________
>>> gstreamer-devel mailing list
>>> [hidden email]
>>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>>
>>
>>
>
>
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNZMSqAAoJEJJLw+x5tkpwf70H/3cCWbx0QuSitIAZGphCxqKr
f+ZOV7ryu8urubKGCqBVY12Ebxxf39+jpTlBJiDxUl2o6tpUYCHaltID+0G8slqb
vfP+6r9dl2zHnSuHTUzwHMBiV9PUB07o4Zd2Vpw/ffCHrM2b1iwq401PDlJbiGWP
kc4ywAGn0h70nrJJMcpV60KFGshfQUrb9TWwos6VdAkITAMJ8+s7AAJyjI7941ZV
/OXO2jpZ0BL7EDmMlKI3nMtRqC7ipCcgdvtzNtl2mVVvekPOqsuZaXM4PWr+caHX
919EEVLXTfMGCurjBNg6SBUPZxj6gzHNpEKb8TTjypGq+OyhNlHL8fp/TQT3dmA=
=18Vq
-----END PGP SIGNATURE-----
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Realtime priority

Stefan Sauer
In reply to this post by Mathias Gyllengahm
On 22.02.2011 16:16, Mathias Gyllengahm wrote:

> Hi again,
>
> I'd like to let my gstreamer process have realtime priority. I have
> tried to do it with prefix the whole thing with "chrt -r -p 99" but I get:
>
> GThread-ERROR **: file
> /build/buildd/glib2.0-2.24.1/gthread/gthread-posix.c: line 348
> (g_thread_create_posix_impl): error 'Invalid argument' during
> 'pthread_attr_setschedparam (&attr, &sched)'
>
> Doing a chrt by pid afterwards has no effect at all. This is my
> pipeline, and it's clear that it has problems when cpu load goes up -
> and I'd like to avoid that. I've seen something about realtime
> priorities when it comes to using the API - but is there a way to do
> it when using gst-launch?

Are you aware that switching to rt scheduling won't help if too hight
cpu load is the problem. All you get for SCHED_RR/FIFO is more
deterministic execution. If your pipeline is saturating the CPU power,
you can buy a faster machine or optimize code.

Stefan

>
> Thanks in advance,
> /Mathias
>
> /usr/local/bin/gst-launch-0.10 -v
> --gst-plugin-path=/usr/local/lib/gstreamer-0.10 \
>     v4l2src \
>     ! videorate \
>     ! video/x-raw-yuv,width=320,height=240,framerate=15/1 \
>     ! ffmpegcolorspace \
>     ! x264enc bitrate=152 subme=4 b-pyramid=true weightb=true \
>     ! queue2 \
>     ! flvmux name=mux \
>     alsasrc device=hw:0,0 \
>     ! audio/x-raw-int,rate=22050,channels=2,depth=16 \
>     ! audiorate \
>     ! queue2 max-size-buffers=600 max-size-bytes=0 max-size-time=0 \
>     ! audioconvert \
>     ! lamemp3enc target=1 bitrate=40 mono=true
> encoding-engine-quality=1 target=bitrate \
>     ! mux. mux. \
>     ! queue2 \
>     ! filesink location=outfile.flv sync=false
>
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Realtime priority

Mathias Gyllengahm
Thanks a lot for your replies, guys!

Yes, I'm aware that I cannot exceed CPU usage - I've read some threads about how it's not possible for the encoder to know that it should throw away frames in case they're likely to not be encoded in time. My system seems to work fine as long as I don't have any other processes that hog it.

Again, thanks!
/Mathias

2011/2/23 Stefan Kost <[hidden email]>
On 22.02.2011 16:16, Mathias Gyllengahm wrote:
> Hi again,
>
> I'd like to let my gstreamer process have realtime priority. I have
> tried to do it with prefix the whole thing with "chrt -r -p 99" but I get:
>
> GThread-ERROR **: file
> /build/buildd/glib2.0-2.24.1/gthread/gthread-posix.c: line 348
> (g_thread_create_posix_impl): error 'Invalid argument' during
> 'pthread_attr_setschedparam (&attr, &sched)'
>
> Doing a chrt by pid afterwards has no effect at all. This is my
> pipeline, and it's clear that it has problems when cpu load goes up -
> and I'd like to avoid that. I've seen something about realtime
> priorities when it comes to using the API - but is there a way to do
> it when using gst-launch?

Are you aware that switching to rt scheduling won't help if too hight
cpu load is the problem. All you get for SCHED_RR/FIFO is more
deterministic execution. If your pipeline is saturating the CPU power,
you can buy a faster machine or optimize code.

Stefan

>
> Thanks in advance,
> /Mathias
>
> /usr/local/bin/gst-launch-0.10 -v
> --gst-plugin-path=/usr/local/lib/gstreamer-0.10 \
>     v4l2src \
>     ! videorate \
>     ! video/x-raw-yuv,width=320,height=240,framerate=15/1 \
>     ! ffmpegcolorspace \
>     ! x264enc bitrate=152 subme=4 b-pyramid=true weightb=true \
>     ! queue2 \
>     ! flvmux name=mux \
>     alsasrc device=hw:0,0 \
>     ! audio/x-raw-int,rate=22050,channels=2,depth=16 \
>     ! audiorate \
>     ! queue2 max-size-buffers=600 max-size-bytes=0 max-size-time=0 \
>     ! audioconvert \
>     ! lamemp3enc target=1 bitrate=40 mono=true
> encoding-engine-quality=1 target=bitrate \
>     ! mux. mux. \
>     ! queue2 \
>     ! filesink location=outfile.flv sync=false
>
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel