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

Side by Side Diff: talk/media/base/videocapturer.cc

Issue 1655793003: Make cricket::VideoCapturer implement VideoSourceInterface (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Adding VideoSourceInterface and letting cricket::VideoCapturer implement it Created 4 years, 10 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 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 void VideoCapturer::OnFrameCaptured(VideoCapturer*, 343 void VideoCapturer::OnFrameCaptured(VideoCapturer*,
344 const CapturedFrame* captured_frame) { 344 const CapturedFrame* captured_frame) {
345 if (muted_) { 345 if (muted_) {
346 if (black_frame_count_down_ == 0) { 346 if (black_frame_count_down_ == 0) {
347 thread_->Post(this, MSG_DO_PAUSE, NULL); 347 thread_->Post(this, MSG_DO_PAUSE, NULL);
348 } else { 348 } else {
349 --black_frame_count_down_; 349 --black_frame_count_down_;
350 } 350 }
351 } 351 }
352 352
353 if (SignalVideoFrame.is_empty()) { 353 if (SignalVideoFrame.is_empty() && !HasSinks()) {
354 return; 354 return;
355 } 355 }
356 356
357 // Use a temporary buffer to scale 357 // Use a temporary buffer to scale
358 rtc::scoped_ptr<uint8_t[]> scale_buffer; 358 rtc::scoped_ptr<uint8_t[]> scale_buffer;
359 359
360 if (IsScreencast()) { 360 if (IsScreencast()) {
361 int scaled_width, scaled_height; 361 int scaled_width, scaled_height;
362 int desired_screencast_fps = capture_format_.get() ? 362 int desired_screencast_fps = capture_format_.get() ?
363 VideoFormat::IntervalToFps(capture_format_->interval) : 363 VideoFormat::IntervalToFps(capture_format_->interval) :
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 LOG(LS_ERROR) << "Couldn't convert to I420! " 526 LOG(LS_ERROR) << "Couldn't convert to I420! "
527 << "From " << ToString(captured_frame) << " To " 527 << "From " << ToString(captured_frame) << " To "
528 << cropped_width << " x " << cropped_height; 528 << cropped_width << " x " << cropped_height;
529 return; 529 return;
530 } 530 }
531 531
532 if (muted_) { 532 if (muted_) {
533 // TODO(pthatcher): Use frame_factory_->CreateBlackFrame() instead. 533 // TODO(pthatcher): Use frame_factory_->CreateBlackFrame() instead.
534 adapted_frame->SetToBlack(); 534 adapted_frame->SetToBlack();
535 } 535 }
536 DeliverFrame(adapted_frame.get());
536 SignalVideoFrame(this, adapted_frame.get()); 537 SignalVideoFrame(this, adapted_frame.get());
pthatcher 2016/02/01 18:40:54 We should leave a comment about how we fire both w
perkj_webrtc 2016/02/02 16:24:00 SignalVideoFrame now removed. I was just not done
537 538
538 UpdateStats(captured_frame); 539 UpdateStats(captured_frame);
539 } 540 }
540 541
541 void VideoCapturer::SetCaptureState(CaptureState state) { 542 void VideoCapturer::SetCaptureState(CaptureState state) {
542 if (state == capture_state_) { 543 if (state == capture_state_) {
543 // Don't trigger a state changed callback if the state hasn't changed. 544 // Don't trigger a state changed callback if the state hasn't changed.
544 return; 545 return;
545 } 546 }
546 StateChangeParams* state_params = new StateChangeParams(state); 547 StateChangeParams* state_params = new StateChangeParams(state);
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 void VideoCapturer::GetVariableSnapshot( 720 void VideoCapturer::GetVariableSnapshot(
720 const rtc::RollingAccumulator<T>& data, 721 const rtc::RollingAccumulator<T>& data,
721 VariableInfo<T>* stats) { 722 VariableInfo<T>* stats) {
722 stats->max_val = data.ComputeMax(); 723 stats->max_val = data.ComputeMax();
723 stats->mean = data.ComputeMean(); 724 stats->mean = data.ComputeMean();
724 stats->min_val = data.ComputeMin(); 725 stats->min_val = data.ComputeMin();
725 stats->variance = data.ComputeVariance(); 726 stats->variance = data.ComputeVariance();
726 } 727 }
727 728
728 } // namespace cricket 729 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698