# Pros/Cons of producer.pause() vs producer.close()

**URL:** <https://mediasoup.discourse.group/t/pros-cons-of-producer-pause-vs-producer-close/2960>\
**Category:** mediasoup libraries\
**Created:** [June 24, 2021, 12:13am UTC](https://mediasoup.discourse.group/t/pros-cons-of-producer-pause-vs-producer-close/2960 "2021-06-24T00:13:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vzhou842](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/vzhou842/32/848_2.png) [@vzhou842](https://mediasoup.discourse.group/u/vzhou842)\
**Post date:** [June 24, 2021, 12:13am UTC](https://mediasoup.discourse.group/t/pros-cons-of-producer-pause-vs-producer-close/2960/1 "2021-06-24T00:13:54Z")

</div>

I’m trying to understand the tradeoffs between closing and recreating producers on mute/unmute versus just pausing/resuming the producer. This topic is a bit similar to [this previous one](https://mediasoup.discourse.group/t/how-to-decide-on-pausing-producers-consumers-vs-setting-up-destroying-producers-consumers/1872) where the response was “pause/resuming is ok”, but I’m trying to actually grasp why that’s the preferred method. [This other post](https://mediasoup.discourse.group/t/what-is-difference-between-produce-close-and-produce-pause/1964) is also somewhat similar, but there isn’t really an explanation of why close vs pause in that one either.

Pause/Resume seems to intuitively be the better approach for implementing mute/unmute b/c one would think that’d you’d incur less overhead to run pause/resume, but:

- [the producer will still send silence packets / black frames](https://mediasoup.discourse.group/t/producer-pause-still-uploading-streams/167) when paused, right? sure, there is the `zeroRtpOnPause` option, but I don’t think that’s supported on every browser? It was also recommended to avoid `zeroRtpOnPause` in [this post from 2017](https://mediasoup.discourse.group/t/what-is-the-benefit-of-zerortponpause-if-i-pause-resume-producers-often/2703). There’s also DTX but that isn’t recommended for video I think? Am I missing something in my understanding that pausing instead of closing the producer would have more long-term overhead from periodic black frames?
- from my rudimentary profiling I haven’t found any significant differences between pause/resume and close/recreate - maybe I’m not looking in the right places?
- if you only pause producers instead of closing them, your browser tab will still be marked as using the user’s mic/camera. This is reproducible by going to [https://v3demo.mediasoup.org/](https://v3demo.mediasoup.org/) and muting your mic and camera - in Chrome I see that the tab is still using my A/V. This seems like not a positive thing? FWIW it seems a lot of popular video conferencing products (like Google Meet) have this same behavior though, so maybe users don’t care.

If it helps to have a specific application in mind, we can use mediasoup-demo as an example. I checked that mediasoup-demo does in fact pause/resume producers when muting/unmuting, so I’m wondering: **why?** What was the reasoning behind implementing it that way in the demo?

---

<div class="post-metadata">

**Author:** ![Normando](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/normando/32/1046_2.png) [@Normando](https://mediasoup.discourse.group/u/Normando)\
**Post date:** [June 24, 2021, 3:05am UTC](https://mediasoup.discourse.group/t/pros-cons-of-producer-pause-vs-producer-close/2960/2 "2021-06-24T03:05:27Z")

</div>

Developers let you the right answer, but I presume that is more resource intensive `producer.close()` (and subsequent creation) than `producer.pause() / .resume()`

BTW I am using `zeroRtpOnPause` on Chrome, Firefox and Edge and runs like a charm.

---

<div class="post-metadata">

**Author:** ![vzhou842](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/vzhou842/32/848_2.png) [@vzhou842](https://mediasoup.discourse.group/u/vzhou842)\
**Post date:** [June 28, 2021, 7:25pm UTC](https://mediasoup.discourse.group/t/pros-cons-of-producer-pause-vs-producer-close/2960/3 "2021-06-28T19:25:17Z")

</div>

bump here - still haven’t found anything that satisfactorily explains this, would appreciate any extra insight or links or anything anyone can point me to

---

<div class="post-metadata">

**Author:** ![Normando](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/normando/32/1046_2.png) [@Normando](https://mediasoup.discourse.group/u/Normando)\
**Post date:** [July 1, 2021, 6:28am UTC](https://mediasoup.discourse.group/t/pros-cons-of-producer-pause-vs-producer-close/2960/4 "2021-07-01T06:28:09Z")

</div>

Take a look at [src](https://github.com/versatica/mediasoup/tree/v3/worker)

---

<div class="post-metadata">

**Author:** ![BronzedBroth](https://avatars.discourse-cdn.com/v4/letter/b/ad7895/32.png) [@BronzedBroth](https://mediasoup.discourse.group/u/BronzedBroth)\
**Post date:** [July 3, 2021, 1:18pm UTC](https://mediasoup.discourse.group/t/pros-cons-of-producer-pause-vs-producer-close/2960/5 "2021-07-03T13:18:02Z")

</div>

It takes more time to re-connect a stream via signalling and the connection of the RTP than to pause/resume.

To sum, it’s less overall use on the CPU to keep a resume/pause in mind and will be noticed greatly when running large tests or have a user base greater than 200 active.
