Many webrtc objects are reference counted, both internally, and in the advertised C++ PeerConnection API, with references managed via the "smart pointer " type rtc::scoped_refptr (which predates std::shared_ptr, and works a bit different).
For historical reasons, the rtc::scoped_refptr class supports implicit conversion to and from raw pointer; one can pass a T* wherever a rtc::scoped_refptr<T> is expected and vice versa, and these implicit conversions makes ownership of objects much less visible.
I intend to delete implicit conversion in one direction, from raw pointer to rtc::scoped_refptr, soon, but at the earliest two weeks from now, February 3. The planned change is in
https://webrtc-review.googlesource.com/c/src/+/247362, note that the special case of implicit conversion from nullptr is kept.
Implicit conversion in the other direction, from rtc::scoped_refptr<T> to T*, without using the .get() method, will hopefully be deleted too, at some later time.
Regards,
/Niels Möller