OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 captured_frame_.pixel_height = 1; | 60 captured_frame_.pixel_height = 1; |
61 captured_frame_.pixel_width = 1; | 61 captured_frame_.pixel_width = 1; |
62 captured_frame_.rotation = 0; | 62 captured_frame_.rotation = 0; |
63 captured_frame_.data = NULL; | 63 captured_frame_.data = NULL; |
64 captured_frame_.data_size = cricket::CapturedFrame::kUnknownDataSize; | 64 captured_frame_.data_size = cricket::CapturedFrame::kUnknownDataSize; |
65 captured_frame_.fourcc = static_cast<uint32>(cricket::FOURCC_ANY); | 65 captured_frame_.fourcc = static_cast<uint32>(cricket::FOURCC_ANY); |
66 } | 66 } |
67 | 67 |
68 void UpdateCapturedFrame(void* frame_data, | 68 void UpdateCapturedFrame(void* frame_data, |
69 int length, | 69 int length, |
| 70 int width, |
| 71 int height, |
70 int rotation, | 72 int rotation, |
71 int64 time_stamp_in_ns) { | 73 int64 time_stamp_in_ns) { |
72 captured_frame_.fourcc = static_cast<uint32>(cricket::FOURCC_YV12); | 74 captured_frame_.fourcc = static_cast<uint32>(cricket::FOURCC_YV12); |
73 captured_frame_.data = frame_data; | 75 captured_frame_.data = frame_data; |
| 76 captured_frame_.width = width; |
| 77 captured_frame_.height = height; |
74 captured_frame_.elapsed_time = rtc::TimeNanos() - start_time_; | 78 captured_frame_.elapsed_time = rtc::TimeNanos() - start_time_; |
75 captured_frame_.time_stamp = time_stamp_in_ns; | 79 captured_frame_.time_stamp = time_stamp_in_ns; |
76 captured_frame_.rotation = rotation; | 80 captured_frame_.rotation = rotation; |
77 captured_frame_.data_size = length; | 81 captured_frame_.data_size = length; |
78 } | 82 } |
79 | 83 |
80 const cricket::CapturedFrame* GetCapturedFrame() const { | 84 const cricket::CapturedFrame* GetCapturedFrame() const { |
81 return &captured_frame_; | 85 return &captured_frame_; |
82 } | 86 } |
83 | 87 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 current_state_ = new_state; | 232 current_state_ = new_state; |
229 | 233 |
230 // TODO(perkj): SetCaptureState can not be used since it posts to |thread_|. | 234 // TODO(perkj): SetCaptureState can not be used since it posts to |thread_|. |
231 // But |thread_ | is currently just the thread that happened to create the | 235 // But |thread_ | is currently just the thread that happened to create the |
232 // cricket::VideoCapturer. | 236 // cricket::VideoCapturer. |
233 SignalStateChange(this, new_state); | 237 SignalStateChange(this, new_state); |
234 } | 238 } |
235 | 239 |
236 void AndroidVideoCapturer::OnIncomingFrame(void* frame_data, | 240 void AndroidVideoCapturer::OnIncomingFrame(void* frame_data, |
237 int length, | 241 int length, |
| 242 int width, |
| 243 int height, |
238 int rotation, | 244 int rotation, |
239 int64 time_stamp) { | 245 int64 time_stamp) { |
240 CHECK(thread_checker_.CalledOnValidThread()); | 246 CHECK(thread_checker_.CalledOnValidThread()); |
241 frame_factory_->UpdateCapturedFrame(frame_data, length, rotation, time_stamp); | 247 frame_factory_->UpdateCapturedFrame(frame_data, length, width, height, |
| 248 rotation, time_stamp); |
242 SignalFrameCaptured(this, frame_factory_->GetCapturedFrame()); | 249 SignalFrameCaptured(this, frame_factory_->GetCapturedFrame()); |
243 } | 250 } |
244 | 251 |
245 void AndroidVideoCapturer::OnOutputFormatRequest( | 252 void AndroidVideoCapturer::OnOutputFormatRequest( |
246 int width, int height, int fps) { | 253 int width, int height, int fps) { |
247 CHECK(thread_checker_.CalledOnValidThread()); | 254 CHECK(thread_checker_.CalledOnValidThread()); |
248 const cricket::VideoFormat& current = video_adapter()->output_format(); | 255 const cricket::VideoFormat& current = video_adapter()->output_format(); |
249 cricket::VideoFormat format( | 256 cricket::VideoFormat format( |
250 width, height, cricket::VideoFormat::FpsToInterval(fps), current.fourcc); | 257 width, height, cricket::VideoFormat::FpsToInterval(fps), current.fourcc); |
251 video_adapter()->OnOutputFormatRequest(format); | 258 video_adapter()->OnOutputFormatRequest(format); |
252 } | 259 } |
253 | 260 |
254 } // namespace webrtc | 261 } // namespace webrtc |
OLD | NEW |