| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 buf.Length() > dump->data.size() && | 203 buf.Length() > dump->data.size() && |
| 204 0 == memcmp(buf.Data(), &dump->data[0], dump->data.size()); | 204 0 == memcmp(buf.Data(), &dump->data[0], dump->data.size()); |
| 205 } else { | 205 } else { |
| 206 return buf.Length() == dump->data.size() && | 206 return buf.Length() == dump->data.size() && |
| 207 0 == memcmp(buf.Data(), &dump->data[0], dump->data.size()); | 207 0 == memcmp(buf.Data(), &dump->data[0], dump->data.size()); |
| 208 } | 208 } |
| 209 } | 209 } |
| 210 | 210 |
| 211 // Implementation of VideoCaptureListener. | 211 // Implementation of VideoCaptureListener. |
| 212 VideoCapturerListener::VideoCapturerListener(VideoCapturer* capturer) | 212 VideoCapturerListener::VideoCapturerListener(VideoCapturer* capturer) |
| 213 : last_capture_state_(CS_STARTING), | 213 : capturer_(capturer), |
| 214 last_capture_state_(CS_STARTING), |
| 214 frame_count_(0), | 215 frame_count_(0), |
| 215 frame_fourcc_(0), | |
| 216 frame_width_(0), | 216 frame_width_(0), |
| 217 frame_height_(0), | 217 frame_height_(0), |
| 218 frame_size_(0), | |
| 219 resolution_changed_(false) { | 218 resolution_changed_(false) { |
| 220 capturer->SignalStateChange.connect(this, | 219 capturer->SignalStateChange.connect(this, |
| 221 &VideoCapturerListener::OnStateChange); | 220 &VideoCapturerListener::OnStateChange); |
| 222 capturer->SignalFrameCaptured.connect(this, | 221 capturer->AddOrUpdateSink(this, rtc::VideoSinkWants()); |
| 223 &VideoCapturerListener::OnFrameCaptured); | 222 } |
| 223 |
| 224 VideoCapturerListener::~VideoCapturerListener() { |
| 225 capturer_->RemoveSink(this); |
| 224 } | 226 } |
| 225 | 227 |
| 226 void VideoCapturerListener::OnStateChange(VideoCapturer* capturer, | 228 void VideoCapturerListener::OnStateChange(VideoCapturer* capturer, |
| 227 CaptureState result) { | 229 CaptureState result) { |
| 228 last_capture_state_ = result; | 230 last_capture_state_ = result; |
| 229 } | 231 } |
| 230 | 232 |
| 231 void VideoCapturerListener::OnFrameCaptured(VideoCapturer* capturer, | 233 void VideoCapturerListener::OnFrame(const VideoFrame& frame) { |
| 232 const CapturedFrame* frame) { | |
| 233 ++frame_count_; | 234 ++frame_count_; |
| 234 if (1 == frame_count_) { | 235 if (1 == frame_count_) { |
| 235 frame_fourcc_ = frame->fourcc; | 236 frame_width_ = frame.width(); |
| 236 frame_width_ = frame->width; | 237 frame_height_ = frame.height(); |
| 237 frame_height_ = frame->height; | 238 } else if (frame_width_ != frame.width() || frame_height_ != frame.height()) { |
| 238 frame_size_ = frame->data_size; | |
| 239 } else if (frame_width_ != frame->width || frame_height_ != frame->height) { | |
| 240 resolution_changed_ = true; | 239 resolution_changed_ = true; |
| 241 } | 240 } |
| 242 } | 241 } |
| 243 | 242 |
| 244 cricket::StreamParams CreateSimStreamParams( | 243 cricket::StreamParams CreateSimStreamParams( |
| 245 const std::string& cname, | 244 const std::string& cname, |
| 246 const std::vector<uint32_t>& ssrcs) { | 245 const std::vector<uint32_t>& ssrcs) { |
| 247 cricket::StreamParams sp; | 246 cricket::StreamParams sp; |
| 248 cricket::SsrcGroup sg(cricket::kSimSsrcGroupSemantics, ssrcs); | 247 cricket::SsrcGroup sg(cricket::kSimSsrcGroupSemantics, ssrcs); |
| 249 sp.ssrcs = ssrcs; | 248 sp.ssrcs = ssrcs; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 263 std::vector<uint32_t> fid_ssrcs; | 262 std::vector<uint32_t> fid_ssrcs; |
| 264 fid_ssrcs.push_back(ssrcs[i]); | 263 fid_ssrcs.push_back(ssrcs[i]); |
| 265 fid_ssrcs.push_back(rtx_ssrcs[i]); | 264 fid_ssrcs.push_back(rtx_ssrcs[i]); |
| 266 cricket::SsrcGroup fid_group(cricket::kFidSsrcGroupSemantics, fid_ssrcs); | 265 cricket::SsrcGroup fid_group(cricket::kFidSsrcGroupSemantics, fid_ssrcs); |
| 267 sp.ssrc_groups.push_back(fid_group); | 266 sp.ssrc_groups.push_back(fid_group); |
| 268 } | 267 } |
| 269 return sp; | 268 return sp; |
| 270 } | 269 } |
| 271 | 270 |
| 272 } // namespace cricket | 271 } // namespace cricket |
| OLD | NEW |