Release buffer pool in Vp8DecoderImpl::Release().
Permits reusing an external VP8DecoderImpl instance from another VideoReceiveStream without a thread-checker DCHECK blowing up. Also releases buffers that would've been kept in memory even though the decoder isn't configured. BUG= R=magjed@webrtc.org, stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/50449004 Cr-Commit-Position: refs/heads/master@{#8807} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8807 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
8904290aca
commit
a3209a2b27
@ -51,7 +51,12 @@ class PooledI420Buffer : public webrtc::VideoFrameBuffer {
|
||||
namespace webrtc {
|
||||
|
||||
I420BufferPool::I420BufferPool() {
|
||||
Release();
|
||||
}
|
||||
|
||||
void I420BufferPool::Release() {
|
||||
thread_checker_.DetachFromThread();
|
||||
buffers_.clear();
|
||||
}
|
||||
|
||||
rtc::scoped_refptr<VideoFrameBuffer> I420BufferPool::CreateBuffer(int width,
|
||||
|
@ -29,6 +29,9 @@ class I420BufferPool {
|
||||
// Returns a buffer from the pool, or creates a new buffer if no suitable
|
||||
// buffer exists in the pool.
|
||||
rtc::scoped_refptr<VideoFrameBuffer> CreateBuffer(int width, int height);
|
||||
// Clears buffers_ and detaches the thread checker so that it can be reused
|
||||
// later from another thread.
|
||||
void Release();
|
||||
|
||||
private:
|
||||
rtc::ThreadChecker thread_checker_;
|
||||
|
@ -1385,6 +1385,7 @@ int VP8DecoderImpl::Release() {
|
||||
delete ref_frame_;
|
||||
ref_frame_ = NULL;
|
||||
}
|
||||
buffer_pool_.Release();
|
||||
inited_ = false;
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user