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

Side by Side Diff: content/renderer/media/webrtc/video_destination_handler.cc

Issue 1142063003: content/child: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Build fix. Created 5 years, 7 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
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/webrtc/video_destination_handler.h" 5 #include "content/renderer/media/webrtc/video_destination_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 11 matching lines...) Expand all
22 #include "third_party/WebKit/public/web/WebMediaStreamRegistry.h" 22 #include "third_party/WebKit/public/web/WebMediaStreamRegistry.h"
23 #include "third_party/libyuv/include/libyuv/convert.h" 23 #include "third_party/libyuv/include/libyuv/convert.h"
24 #include "url/gurl.h" 24 #include "url/gurl.h"
25 25
26 namespace content { 26 namespace content {
27 27
28 class PpFrameWriter::FrameWriterDelegate 28 class PpFrameWriter::FrameWriterDelegate
29 : public base::RefCountedThreadSafe<FrameWriterDelegate> { 29 : public base::RefCountedThreadSafe<FrameWriterDelegate> {
30 public: 30 public:
31 FrameWriterDelegate( 31 FrameWriterDelegate(
32 const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy, 32 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
33 const VideoCaptureDeliverFrameCB& new_frame_callback); 33 const VideoCaptureDeliverFrameCB& new_frame_callback);
34 34
35 void DeliverFrame(const scoped_refptr<media::VideoFrame>& frame); 35 void DeliverFrame(const scoped_refptr<media::VideoFrame>& frame);
36 private: 36 private:
37 friend class base::RefCountedThreadSafe<FrameWriterDelegate>; 37 friend class base::RefCountedThreadSafe<FrameWriterDelegate>;
38 virtual ~FrameWriterDelegate(); 38 virtual ~FrameWriterDelegate();
39 39
40 void DeliverFrameOnIO(const scoped_refptr<media::VideoFrame>& frame); 40 void DeliverFrameOnIO(const scoped_refptr<media::VideoFrame>& frame);
41 41
42 scoped_refptr<base::MessageLoopProxy> io_message_loop_; 42 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
43 VideoCaptureDeliverFrameCB new_frame_callback_; 43 VideoCaptureDeliverFrameCB new_frame_callback_;
44 }; 44 };
45 45
46 PpFrameWriter::FrameWriterDelegate::FrameWriterDelegate( 46 PpFrameWriter::FrameWriterDelegate::FrameWriterDelegate(
47 const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy, 47 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
48 const VideoCaptureDeliverFrameCB& new_frame_callback) 48 const VideoCaptureDeliverFrameCB& new_frame_callback)
49 : io_message_loop_(io_message_loop_proxy), 49 : io_task_runner_(io_task_runner), new_frame_callback_(new_frame_callback) {
50 new_frame_callback_(new_frame_callback) {
51 } 50 }
52 51
53 PpFrameWriter::FrameWriterDelegate::~FrameWriterDelegate() { 52 PpFrameWriter::FrameWriterDelegate::~FrameWriterDelegate() {
54 } 53 }
55 54
56 void PpFrameWriter::FrameWriterDelegate::DeliverFrame( 55 void PpFrameWriter::FrameWriterDelegate::DeliverFrame(
57 const scoped_refptr<media::VideoFrame>& frame) { 56 const scoped_refptr<media::VideoFrame>& frame) {
58 io_message_loop_->PostTask( 57 io_task_runner_->PostTask(
59 FROM_HERE, 58 FROM_HERE,
60 base::Bind(&FrameWriterDelegate::DeliverFrameOnIO, this, frame)); 59 base::Bind(&FrameWriterDelegate::DeliverFrameOnIO, this, frame));
61 } 60 }
62 61
63 void PpFrameWriter::FrameWriterDelegate::DeliverFrameOnIO( 62 void PpFrameWriter::FrameWriterDelegate::DeliverFrameOnIO(
64 const scoped_refptr<media::VideoFrame>& frame) { 63 const scoped_refptr<media::VideoFrame>& frame) {
65 DCHECK(io_message_loop_->BelongsToCurrentThread()); 64 DCHECK(io_task_runner_->BelongsToCurrentThread());
66 // The local time when this frame is generated is unknown so give a null 65 // The local time when this frame is generated is unknown so give a null
67 // value to |estimated_capture_time|. 66 // value to |estimated_capture_time|.
68 new_frame_callback_.Run(frame, base::TimeTicks()); 67 new_frame_callback_.Run(frame, base::TimeTicks());
69 } 68 }
70 69
71 PpFrameWriter::PpFrameWriter() { 70 PpFrameWriter::PpFrameWriter() {
72 DVLOG(3) << "PpFrameWriter ctor"; 71 DVLOG(3) << "PpFrameWriter ctor";
73 } 72 }
74 73
75 PpFrameWriter::~PpFrameWriter() { 74 PpFrameWriter::~PpFrameWriter() {
(...skipping 13 matching lines...) Expand all
89 callback.Run(formats); 88 callback.Run(formats);
90 } 89 }
91 90
92 void PpFrameWriter::StartSourceImpl( 91 void PpFrameWriter::StartSourceImpl(
93 const media::VideoCaptureFormat& format, 92 const media::VideoCaptureFormat& format,
94 const blink::WebMediaConstraints& constraints, 93 const blink::WebMediaConstraints& constraints,
95 const VideoCaptureDeliverFrameCB& frame_callback) { 94 const VideoCaptureDeliverFrameCB& frame_callback) {
96 DCHECK(CalledOnValidThread()); 95 DCHECK(CalledOnValidThread());
97 DCHECK(!delegate_.get()); 96 DCHECK(!delegate_.get());
98 DVLOG(3) << "PpFrameWriter::StartSourceImpl()"; 97 DVLOG(3) << "PpFrameWriter::StartSourceImpl()";
99 delegate_ = new FrameWriterDelegate(io_message_loop(), frame_callback); 98 delegate_ = new FrameWriterDelegate(io_task_runner(), frame_callback);
100 OnStartDone(MEDIA_DEVICE_OK); 99 OnStartDone(MEDIA_DEVICE_OK);
101 } 100 }
102 101
103 void PpFrameWriter::StopSourceImpl() { 102 void PpFrameWriter::StopSourceImpl() {
104 DCHECK(CalledOnValidThread()); 103 DCHECK(CalledOnValidThread());
105 } 104 }
106 105
107 // Note: PutFrame must copy or process image_data directly in this function, 106 // Note: PutFrame must copy or process image_data directly in this function,
108 // because it may be overwritten as soon as we return from this function. 107 // because it may be overwritten as soon as we return from this function.
109 void PpFrameWriter::PutFrame(PPB_ImageData_Impl* image_data, 108 void PpFrameWriter::PutFrame(PPB_ImageData_Impl* image_data,
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 227
229 stream.addTrack(MediaStreamVideoTrack::CreateVideoTrack( 228 stream.addTrack(MediaStreamVideoTrack::CreateVideoTrack(
230 writer, constraints, MediaStreamVideoSource::ConstraintsCallback(), 229 writer, constraints, MediaStreamVideoSource::ConstraintsCallback(),
231 track_enabled)); 230 track_enabled));
232 231
233 *frame_writer = new PpFrameWriterProxy(writer->AsWeakPtr()); 232 *frame_writer = new PpFrameWriterProxy(writer->AsWeakPtr());
234 return true; 233 return true;
235 } 234 }
236 235
237 } // namespace content 236 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/webrtc/media_stream_remote_video_source.cc ('k') | content/renderer/npapi/plugin_channel_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698