OLD | NEW |
---|---|
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 libyuv::BGRAToI420(reinterpret_cast<uint8*>(bitmap->getPixels()), | 109 libyuv::BGRAToI420(reinterpret_cast<uint8*>(bitmap->getPixels()), |
110 bitmap->rowBytes(), | 110 bitmap->rowBytes(), |
111 new_frame->data(media::VideoFrame::kYPlane), | 111 new_frame->data(media::VideoFrame::kYPlane), |
112 new_frame->stride(media::VideoFrame::kYPlane), | 112 new_frame->stride(media::VideoFrame::kYPlane), |
113 new_frame->data(media::VideoFrame::kUPlane), | 113 new_frame->data(media::VideoFrame::kUPlane), |
114 new_frame->stride(media::VideoFrame::kUPlane), | 114 new_frame->stride(media::VideoFrame::kUPlane), |
115 new_frame->data(media::VideoFrame::kVPlane), | 115 new_frame->data(media::VideoFrame::kVPlane), |
116 new_frame->stride(media::VideoFrame::kVPlane), | 116 new_frame->stride(media::VideoFrame::kVPlane), |
117 frame_size.width(), frame_size.height()); | 117 frame_size.width(), frame_size.height()); |
118 | 118 |
119 DeliverVideoFrame(new_frame); | 119 // TODO(hclam): Should take into account |timestamp|. |
120 // Not all sinks care about the TimeTicks so it's not a problem now. | |
Ami GONE FROM CHROMIUM
2014/04/24 21:04:31
ditto comment elsewhere, why wouldn't you use |tim
Alpha Left Google
2014/04/24 22:50:34
The parameter is a TimeTicks. I would need to save
Ami GONE FROM CHROMIUM
2014/04/24 23:05:18
I'm unclear on why synchronization can't be done u
Alpha Left Google
2014/04/24 23:33:53
When a frame is captured in the browser. It is tag
| |
121 DeliverVideoFrame(new_frame, format_, base::TimeTicks::Now()); | |
120 } | 122 } |
121 | 123 |
122 // PpFrameWriterProxy is a helper class to make sure the user won't use | 124 // PpFrameWriterProxy is a helper class to make sure the user won't use |
123 // PpFrameWriter after it is released (IOW its owner - WebMediaStreamSource - | 125 // PpFrameWriter after it is released (IOW its owner - WebMediaStreamSource - |
124 // is released). | 126 // is released). |
125 class PpFrameWriterProxy : public FrameWriterInterface { | 127 class PpFrameWriterProxy : public FrameWriterInterface { |
126 public: | 128 public: |
127 explicit PpFrameWriterProxy(const base::WeakPtr<PpFrameWriter>& writer) | 129 explicit PpFrameWriterProxy(const base::WeakPtr<PpFrameWriter>& writer) |
128 : writer_(writer) { | 130 : writer_(writer) { |
129 DCHECK(writer_ != NULL); | 131 DCHECK(writer_ != NULL); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
183 | 185 |
184 stream.addTrack(MediaStreamVideoTrack::CreateVideoTrack( | 186 stream.addTrack(MediaStreamVideoTrack::CreateVideoTrack( |
185 writer, constraints, MediaStreamVideoSource::ConstraintsCallback(), | 187 writer, constraints, MediaStreamVideoSource::ConstraintsCallback(), |
186 track_enabled)); | 188 track_enabled)); |
187 | 189 |
188 *frame_writer = new PpFrameWriterProxy(writer->AsWeakPtr()); | 190 *frame_writer = new PpFrameWriterProxy(writer->AsWeakPtr()); |
189 return true; | 191 return true; |
190 } | 192 } |
191 | 193 |
192 } // namespace content | 194 } // namespace content |
193 | |
OLD | NEW |