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

Side by Side Diff: talk/app/webrtc/videosource.cc

Issue 1660103003: Delete FrameInput method and FrameInputWrapper class. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Comment improvement. 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
« no previous file with comments | « talk/app/webrtc/videosource.h ('k') | talk/app/webrtc/videosource_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 cricket::VideoOptions* options) { 287 cricket::VideoOptions* options) {
288 bool all_valid = true; 288 bool all_valid = true;
289 289
290 all_valid &= ExtractOption(all_constraints, 290 all_valid &= ExtractOption(all_constraints,
291 MediaConstraintsInterface::kNoiseReduction, 291 MediaConstraintsInterface::kNoiseReduction,
292 &(options->video_noise_reduction)); 292 &(options->video_noise_reduction));
293 293
294 return all_valid; 294 return all_valid;
295 } 295 }
296 296
297 class FrameInputWrapper : public cricket::VideoRenderer {
298 public:
299 explicit FrameInputWrapper(cricket::VideoCapturer* capturer)
300 : capturer_(capturer) {
301 ASSERT(capturer_ != NULL);
302 }
303
304 virtual ~FrameInputWrapper() {}
305
306 // VideoRenderer implementation.
307 bool RenderFrame(const cricket::VideoFrame* frame) override {
308 if (!capturer_->IsRunning()) {
309 return true;
310 }
311
312 // This signal will be made on media engine render thread. The clients
313 // of this signal should have no assumptions on what thread this signal
314 // come from.
315 capturer_->SignalVideoFrame(capturer_, frame);
316 return true;
317 }
318
319 private:
320 cricket::VideoCapturer* capturer_;
321
322 RTC_DISALLOW_COPY_AND_ASSIGN(FrameInputWrapper);
323 };
324
325 } // anonymous namespace 297 } // anonymous namespace
326 298
327 namespace webrtc { 299 namespace webrtc {
328 300
329 rtc::scoped_refptr<VideoSource> VideoSource::Create( 301 rtc::scoped_refptr<VideoSource> VideoSource::Create(
330 cricket::ChannelManager* channel_manager, 302 cricket::ChannelManager* channel_manager,
331 cricket::VideoCapturer* capturer, 303 cricket::VideoCapturer* capturer,
332 const webrtc::MediaConstraintsInterface* constraints, 304 const webrtc::MediaConstraintsInterface* constraints,
333 bool remote) { 305 bool remote) {
334 ASSERT(channel_manager != NULL); 306 ASSERT(channel_manager != NULL);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 // the camera doesn't produce frames with the correct format? Or will 383 // the camera doesn't produce frames with the correct format? Or will
412 // cricket::VideCapturer be able to re-scale / crop to the requested 384 // cricket::VideCapturer be able to re-scale / crop to the requested
413 // resolution? 385 // resolution?
414 if (!channel_manager_->StartVideoCapture(video_capturer_.get(), format_)) { 386 if (!channel_manager_->StartVideoCapture(video_capturer_.get(), format_)) {
415 SetState(kEnded); 387 SetState(kEnded);
416 return; 388 return;
417 } 389 }
418 // Initialize hasn't succeeded until a successful state change has occurred. 390 // Initialize hasn't succeeded until a successful state change has occurred.
419 } 391 }
420 392
421 cricket::VideoRenderer* VideoSource::FrameInput() {
422 // Defer creation of frame_input_ until it's needed, e.g. the local video
423 // sources will never need it.
424 if (!frame_input_) {
425 frame_input_.reset(new FrameInputWrapper(video_capturer_.get()));
426 }
427 return frame_input_.get();
428 }
429
430 void VideoSource::Stop() { 393 void VideoSource::Stop() {
431 channel_manager_->StopVideoCapture(video_capturer_.get(), format_); 394 channel_manager_->StopVideoCapture(video_capturer_.get(), format_);
432 } 395 }
433 396
434 void VideoSource::Restart() { 397 void VideoSource::Restart() {
435 if (!channel_manager_->StartVideoCapture(video_capturer_.get(), format_)) { 398 if (!channel_manager_->StartVideoCapture(video_capturer_.get(), format_)) {
436 SetState(kEnded); 399 SetState(kEnded);
437 return; 400 return;
438 } 401 }
439 for (auto* sink : sinks_) { 402 for (auto* sink : sinks_) {
(...skipping 26 matching lines...) Expand all
466 void VideoSource::SetState(SourceState new_state) { 429 void VideoSource::SetState(SourceState new_state) {
467 // TODO(hbos): Temporarily disabled VERIFY due to webrtc:4776. 430 // TODO(hbos): Temporarily disabled VERIFY due to webrtc:4776.
468 // if (VERIFY(state_ != new_state)) { 431 // if (VERIFY(state_ != new_state)) {
469 if (state_ != new_state) { 432 if (state_ != new_state) {
470 state_ = new_state; 433 state_ = new_state;
471 FireOnChanged(); 434 FireOnChanged();
472 } 435 }
473 } 436 }
474 437
475 } // namespace webrtc 438 } // namespace webrtc
OLDNEW
« no previous file with comments | « talk/app/webrtc/videosource.h ('k') | talk/app/webrtc/videosource_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698