OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/webrtc_video_capturer_adapter.h" | 5 #include "content/renderer/media/webrtc/webrtc_video_capturer_adapter.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/aligned_memory.h" | 8 #include "base/memory/aligned_memory.h" |
9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
10 #include "content/renderer/media/webrtc/webrtc_video_frame_adapter.h" | 10 #include "content/renderer/media/webrtc/webrtc_video_frame_adapter.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // actual pixel data. | 42 // actual pixel data. |
43 captured_frame_.width = frame->natural_size().width(); | 43 captured_frame_.width = frame->natural_size().width(); |
44 captured_frame_.height = frame->natural_size().height(); | 44 captured_frame_.height = frame->natural_size().height(); |
45 captured_frame_.time_stamp = frame->timestamp().InMicroseconds() * | 45 captured_frame_.time_stamp = frame->timestamp().InMicroseconds() * |
46 base::Time::kNanosecondsPerMicrosecond; | 46 base::Time::kNanosecondsPerMicrosecond; |
47 captured_frame_.pixel_height = 1; | 47 captured_frame_.pixel_height = 1; |
48 captured_frame_.pixel_width = 1; | 48 captured_frame_.pixel_width = 1; |
49 captured_frame_.rotation = webrtc::kVideoRotation_0; | 49 captured_frame_.rotation = webrtc::kVideoRotation_0; |
50 captured_frame_.data = NULL; | 50 captured_frame_.data = NULL; |
51 captured_frame_.data_size = cricket::CapturedFrame::kUnknownDataSize; | 51 captured_frame_.data_size = cricket::CapturedFrame::kUnknownDataSize; |
52 captured_frame_.fourcc = static_cast<uint32>(cricket::FOURCC_ANY); | 52 captured_frame_.fourcc = static_cast<uint32_t>(cricket::FOURCC_ANY); |
53 | 53 |
54 frame_ = frame; | 54 frame_ = frame; |
55 } | 55 } |
56 | 56 |
57 void ReleaseFrame() { frame_ = NULL; } | 57 void ReleaseFrame() { frame_ = NULL; } |
58 | 58 |
59 const cricket::CapturedFrame* GetCapturedFrame() const { | 59 const cricket::CapturedFrame* GetCapturedFrame() const { |
60 return &captured_frame_; | 60 return &captured_frame_; |
61 } | 61 } |
62 | 62 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 SetCaptureFormat(NULL); | 176 SetCaptureFormat(NULL); |
177 SignalStateChange(this, cricket::CS_STOPPED); | 177 SignalStateChange(this, cricket::CS_STOPPED); |
178 } | 178 } |
179 | 179 |
180 bool WebRtcVideoCapturerAdapter::IsRunning() { | 180 bool WebRtcVideoCapturerAdapter::IsRunning() { |
181 DCHECK(thread_checker_.CalledOnValidThread()); | 181 DCHECK(thread_checker_.CalledOnValidThread()); |
182 return running_; | 182 return running_; |
183 } | 183 } |
184 | 184 |
185 bool WebRtcVideoCapturerAdapter::GetPreferredFourccs( | 185 bool WebRtcVideoCapturerAdapter::GetPreferredFourccs( |
186 std::vector<uint32>* fourccs) { | 186 std::vector<uint32_t>* fourccs) { |
187 DCHECK(thread_checker_.CalledOnValidThread()); | 187 DCHECK(thread_checker_.CalledOnValidThread()); |
188 DCHECK(!fourccs || fourccs->empty()); | 188 DCHECK(!fourccs || fourccs->empty()); |
189 if (fourccs) | 189 if (fourccs) |
190 fourccs->push_back(cricket::FOURCC_I420); | 190 fourccs->push_back(cricket::FOURCC_I420); |
191 return fourccs != NULL; | 191 return fourccs != NULL; |
192 } | 192 } |
193 | 193 |
194 bool WebRtcVideoCapturerAdapter::IsScreencast() const { | 194 bool WebRtcVideoCapturerAdapter::IsScreencast() const { |
195 return is_screencast_; | 195 return is_screencast_; |
196 } | 196 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 reinterpret_cast<MediaVideoFrameFactory*>(frame_factory()); | 230 reinterpret_cast<MediaVideoFrameFactory*>(frame_factory()); |
231 media_video_frame_factory->SetFrame(frame); | 231 media_video_frame_factory->SetFrame(frame); |
232 | 232 |
233 // This signals to libJingle that a new VideoFrame is available. | 233 // This signals to libJingle that a new VideoFrame is available. |
234 SignalFrameCaptured(this, media_video_frame_factory->GetCapturedFrame()); | 234 SignalFrameCaptured(this, media_video_frame_factory->GetCapturedFrame()); |
235 | 235 |
236 media_video_frame_factory->ReleaseFrame(); // Release the frame ASAP. | 236 media_video_frame_factory->ReleaseFrame(); // Release the frame ASAP. |
237 } | 237 } |
238 | 238 |
239 } // namespace content | 239 } // namespace content |
OLD | NEW |