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

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

Issue 617093003: Add MediaStreamSource frame rate calculation to the tracker. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding type name. Fixing IPC type problem. Created 6 years, 2 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"
11 #include "base/rand_util.h" 11 #include "base/rand_util.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "content/renderer/media/media_stream.h" 13 #include "content/renderer/media/media_stream.h"
14 #include "content/renderer/media/media_stream_registry_interface.h" 14 #include "content/renderer/media/media_stream_registry_interface.h"
15 #include "content/renderer/media/media_stream_video_track.h" 15 #include "content/renderer/media/media_stream_video_track.h"
16 #include "content/renderer/pepper/ppb_image_data_impl.h" 16 #include "content/renderer/pepper/ppb_image_data_impl.h"
17 #include "content/renderer/render_thread_impl.h" 17 #include "content/renderer/render_thread_impl.h"
18 #include "media/video/capture/video_capture_types.h" 18 #include "media/video/capture/video_capture_types.h"
19 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" 19 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
20 #include "third_party/WebKit/public/platform/WebURL.h" 20 #include "third_party/WebKit/public/platform/WebURL.h"
21 #include "third_party/WebKit/public/web/WebMediaStreamRegistry.h" 21 #include "third_party/WebKit/public/web/WebMediaStreamRegistry.h"
22 #include "third_party/libyuv/include/libyuv/convert.h" 22 #include "third_party/libyuv/include/libyuv/convert.h"
23 #include "url/gurl.h" 23 #include "url/gurl.h"
24 24
25 namespace content { 25 namespace content {
26 26
27 const char kTypeName[] = "Pepper Plugin";
28
27 class PpFrameWriter::FrameWriterDelegate 29 class PpFrameWriter::FrameWriterDelegate
28 : public base::RefCountedThreadSafe<FrameWriterDelegate> { 30 : public base::RefCountedThreadSafe<FrameWriterDelegate> {
29 public: 31 public:
30 FrameWriterDelegate( 32 FrameWriterDelegate(
31 const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy, 33 const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy,
32 const VideoCaptureDeliverFrameCB& new_frame_callback); 34 const VideoCaptureDeliverFrameCB& new_frame_callback);
33 35
34 void DeliverFrame(const scoped_refptr<media::VideoFrame>& frame, 36 void DeliverFrame(const scoped_refptr<media::VideoFrame>& frame,
35 const media::VideoCaptureFormat& format); 37 const media::VideoCaptureFormat& format);
36 private: 38 private:
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 DCHECK(!delegate_.get()); 102 DCHECK(!delegate_.get());
101 DVLOG(3) << "PpFrameWriter::StartSourceImpl()"; 103 DVLOG(3) << "PpFrameWriter::StartSourceImpl()";
102 delegate_ = new FrameWriterDelegate(io_message_loop(), frame_callback); 104 delegate_ = new FrameWriterDelegate(io_message_loop(), frame_callback);
103 OnStartDone(MEDIA_DEVICE_OK); 105 OnStartDone(MEDIA_DEVICE_OK);
104 } 106 }
105 107
106 void PpFrameWriter::StopSourceImpl() { 108 void PpFrameWriter::StopSourceImpl() {
107 DCHECK(CalledOnValidThread()); 109 DCHECK(CalledOnValidThread());
108 } 110 }
109 111
112 std::string PpFrameWriter::TypeName() const {
113 return kTypeName;
114 }
115
110 void PpFrameWriter::PutFrame(PPB_ImageData_Impl* image_data, 116 void PpFrameWriter::PutFrame(PPB_ImageData_Impl* image_data,
111 int64 time_stamp_ns) { 117 int64 time_stamp_ns) {
112 DCHECK(CalledOnValidThread()); 118 DCHECK(CalledOnValidThread());
113 DVLOG(3) << "PpFrameWriter::PutFrame()"; 119 DVLOG(3) << "PpFrameWriter::PutFrame()";
114 120
115 if (!image_data) { 121 if (!image_data) {
116 LOG(ERROR) << "PpFrameWriter::PutFrame - Called with NULL image_data."; 122 LOG(ERROR) << "PpFrameWriter::PutFrame - Called with NULL image_data.";
117 return; 123 return;
118 } 124 }
119 ImageDataAutoMapper mapper(image_data); 125 ImageDataAutoMapper mapper(image_data);
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 233
228 stream.addTrack(MediaStreamVideoTrack::CreateVideoTrack( 234 stream.addTrack(MediaStreamVideoTrack::CreateVideoTrack(
229 writer, constraints, MediaStreamVideoSource::ConstraintsCallback(), 235 writer, constraints, MediaStreamVideoSource::ConstraintsCallback(),
230 track_enabled)); 236 track_enabled));
231 237
232 *frame_writer = new PpFrameWriterProxy(writer->AsWeakPtr()); 238 *frame_writer = new PpFrameWriterProxy(writer->AsWeakPtr());
233 return true; 239 return true;
234 } 240 }
235 241
236 } // namespace content 242 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/webrtc/video_destination_handler.h ('k') | media/video/capture/video_capture_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698