Fix crashes due to dangling external decoder pointer.
When checking whether we need to release external decoder, we have to do pointer comparison. We can't rely on payload types, because payload types can be stale (e.g. before we decode the first video frame after RegisterReceiveCodec). This leaves a dangling pointer to external decoder, which leads to crashes later, after we actually delete the external decoder object. This change has been verified in Chromecast code tree. BUG=chromium:335539 R=stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/12049004 Patch from Sergey Volk <servolk@chromium.org>. git-svn-id: http://webrtc.googlecode.com/svn/trunk@5922 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
39b868bad3
commit
c0a15b7ddc
@ -382,7 +382,11 @@ bool VCMCodecDataBase::DeregisterExternalDecoder(uint8_t payload_type) {
|
|||||||
// Not found
|
// Not found
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (receive_codec_.plType == payload_type) {
|
// We can't use payload_type to check if the decoder is currently in use,
|
||||||
|
// because payload type may be out of date (e.g. before we decode the first
|
||||||
|
// frame after RegisterReceiveCodec)
|
||||||
|
if (ptr_decoder_ != NULL &&
|
||||||
|
&ptr_decoder_->_decoder == (*it).second->external_decoder_instance) {
|
||||||
// Release it if it was registered and in use.
|
// Release it if it was registered and in use.
|
||||||
ReleaseDecoder(ptr_decoder_);
|
ReleaseDecoder(ptr_decoder_);
|
||||||
ptr_decoder_ = NULL;
|
ptr_decoder_ = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user