Make FrameGeneratorCapturer own frame_generator.
Fixes memleaks where test::FrameGenerator::Create() was used to create frame_generator, but it was never freed. Since the frame generator shouldn't be used concurrently it's easiest if FrameGeneratorCapturer take ownership of the instance. BUG= R=stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/2047005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4580 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
abc1ed37c6
commit
4c96601aed
@ -26,6 +26,8 @@ class FrameGenerator;
|
||||
|
||||
class FrameGeneratorCapturer : public VideoCapturer {
|
||||
public:
|
||||
// The FrameGeneratorCapturer takes ownership of the FrameGenerator, which
|
||||
// will be freed when the FrameGeneratorCapturer is deleted.
|
||||
static FrameGeneratorCapturer* Create(newapi::VideoSendStreamInput* input,
|
||||
FrameGenerator* frame_generator,
|
||||
int target_fps);
|
||||
@ -47,7 +49,7 @@ class FrameGeneratorCapturer : public VideoCapturer {
|
||||
scoped_ptr<EventWrapper> tick_;
|
||||
scoped_ptr<CriticalSectionWrapper> lock_;
|
||||
scoped_ptr<ThreadWrapper> thread_;
|
||||
FrameGenerator* frame_generator_;
|
||||
scoped_ptr<FrameGenerator> frame_generator_;
|
||||
|
||||
int target_fps_;
|
||||
};
|
||||
|
@ -304,18 +304,15 @@ TEST_P(FullStackTest, NoPacketLoss) {
|
||||
|
||||
Clock* test_clock = Clock::GetRealTimeClock();
|
||||
|
||||
scoped_ptr<test::YuvFileFrameGenerator> file_frame_generator(
|
||||
scoped_ptr<test::FrameGeneratorCapturer> file_capturer(
|
||||
test::FrameGeneratorCapturer::Create(
|
||||
&analyzer,
|
||||
test::YuvFileFrameGenerator::Create(
|
||||
test::ResourcePath(params.clip.name, "yuv").c_str(),
|
||||
params.clip.width,
|
||||
params.clip.height,
|
||||
test_clock));
|
||||
ASSERT_TRUE(file_frame_generator.get() != NULL);
|
||||
|
||||
scoped_ptr<test::FrameGeneratorCapturer> file_capturer(
|
||||
test::FrameGeneratorCapturer::Create(
|
||||
&analyzer, file_frame_generator.get(), params.clip.fps));
|
||||
ASSERT_TRUE(file_capturer.get() != NULL);
|
||||
test_clock),
|
||||
params.clip.fps));
|
||||
|
||||
newapi::VideoReceiveStream::Config receive_config =
|
||||
call->GetDefaultReceiveConfig();
|
||||
|
Loading…
x
Reference in New Issue
Block a user