Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Side by Side Diff: content/renderer/media/video_source_handler.cc

Issue 172843002: The cricket::VideoCapturer on longer makes a copy of the frame from the camera. As a result we can'… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/renderer/media/video_source_handler_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/video_source_handler.h" 5 #include "content/renderer/media/video_source_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "content/renderer/media/media_stream_dependency_factory.h" 10 #include "content/renderer/media/media_stream_dependency_factory.h"
(...skipping 18 matching lines...) Expand all
29 PpFrameReceiver() : reader_(NULL) {} 29 PpFrameReceiver() : reader_(NULL) {}
30 virtual ~PpFrameReceiver() {} 30 virtual ~PpFrameReceiver() {}
31 31
32 // Implements VideoRenderer. 32 // Implements VideoRenderer.
33 virtual bool SetSize(int width, int height, int reserved) OVERRIDE { 33 virtual bool SetSize(int width, int height, int reserved) OVERRIDE {
34 return true; 34 return true;
35 } 35 }
36 virtual bool RenderFrame(const cricket::VideoFrame* frame) OVERRIDE { 36 virtual bool RenderFrame(const cricket::VideoFrame* frame) OVERRIDE {
37 base::AutoLock auto_lock(lock_); 37 base::AutoLock auto_lock(lock_);
38 if (reader_) { 38 if (reader_) {
39 // Make a shallow copy of the frame as the |reader_| may need to queue it. 39 // |frame| will be invalid after this function is returned. So keep a copy
40 // Both frames will share a single reference-counted frame buffer. 40 // before return.
41 reader_->GotFrame(frame->Copy()); 41 cricket::VideoFrame* copied_frame = frame->Copy();
42 copied_frame->MakeExclusive();
43 reader_->GotFrame(copied_frame);
42 } 44 }
43 return true; 45 return true;
44 } 46 }
45 47
46 void SetReader(FrameReaderInterface* reader) { 48 void SetReader(FrameReaderInterface* reader) {
47 base::AutoLock auto_lock(lock_); 49 base::AutoLock auto_lock(lock_);
48 reader_ = reader; 50 reader_ = reader;
49 } 51 }
50 52
51 private: 53 private:
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 receiver_->SetReader(reader); 145 receiver_->SetReader(reader);
144 } 146 }
145 147
146 VideoSourceHandler::SourceInfo::~SourceInfo() { 148 VideoSourceHandler::SourceInfo::~SourceInfo() {
147 source_->RemoveSink(receiver_.get()); 149 source_->RemoveSink(receiver_.get());
148 receiver_->SetReader(NULL); 150 receiver_->SetReader(NULL);
149 } 151 }
150 152
151 } // namespace content 153 } // namespace content
152 154
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/video_source_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698