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

Side by Side Diff: webrtc/examples/peerconnection/client/main_wnd.cc

Issue 1817473002: Delete VideoRendererInterface. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 4 years, 9 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 | « webrtc/examples/peerconnection/client/main_wnd.h ('k') | no next file » | 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 * Copyright 2012 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2012 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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 ::InitializeCriticalSection(&buffer_lock_); 569 ::InitializeCriticalSection(&buffer_lock_);
570 ZeroMemory(&bmi_, sizeof(bmi_)); 570 ZeroMemory(&bmi_, sizeof(bmi_));
571 bmi_.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); 571 bmi_.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
572 bmi_.bmiHeader.biPlanes = 1; 572 bmi_.bmiHeader.biPlanes = 1;
573 bmi_.bmiHeader.biBitCount = 32; 573 bmi_.bmiHeader.biBitCount = 32;
574 bmi_.bmiHeader.biCompression = BI_RGB; 574 bmi_.bmiHeader.biCompression = BI_RGB;
575 bmi_.bmiHeader.biWidth = width; 575 bmi_.bmiHeader.biWidth = width;
576 bmi_.bmiHeader.biHeight = -height; 576 bmi_.bmiHeader.biHeight = -height;
577 bmi_.bmiHeader.biSizeImage = width * height * 577 bmi_.bmiHeader.biSizeImage = width * height *
578 (bmi_.bmiHeader.biBitCount >> 3); 578 (bmi_.bmiHeader.biBitCount >> 3);
579 rendered_track_->AddRenderer(this); 579 rendered_track_->AddOrUpdateSink(this, rtc::VideoSinkWants());
580 } 580 }
581 581
582 MainWnd::VideoRenderer::~VideoRenderer() { 582 MainWnd::VideoRenderer::~VideoRenderer() {
583 rendered_track_->RemoveRenderer(this); 583 rendered_track_->RemoveSink(this);
584 ::DeleteCriticalSection(&buffer_lock_); 584 ::DeleteCriticalSection(&buffer_lock_);
585 } 585 }
586 586
587 void MainWnd::VideoRenderer::SetSize(int width, int height) { 587 void MainWnd::VideoRenderer::SetSize(int width, int height) {
588 AutoLock<VideoRenderer> lock(this); 588 AutoLock<VideoRenderer> lock(this);
589 589
590 if (width == bmi_.bmiHeader.biWidth && height == bmi_.bmiHeader.biHeight) { 590 if (width == bmi_.bmiHeader.biWidth && height == bmi_.bmiHeader.biHeight) {
591 return; 591 return;
592 } 592 }
593 593
594 bmi_.bmiHeader.biWidth = width; 594 bmi_.bmiHeader.biWidth = width;
595 bmi_.bmiHeader.biHeight = -height; 595 bmi_.bmiHeader.biHeight = -height;
596 bmi_.bmiHeader.biSizeImage = width * height * 596 bmi_.bmiHeader.biSizeImage = width * height *
597 (bmi_.bmiHeader.biBitCount >> 3); 597 (bmi_.bmiHeader.biBitCount >> 3);
598 image_.reset(new uint8_t[bmi_.bmiHeader.biSizeImage]); 598 image_.reset(new uint8_t[bmi_.bmiHeader.biSizeImage]);
599 } 599 }
600 600
601 void MainWnd::VideoRenderer::RenderFrame( 601 void MainWnd::VideoRenderer::OnFrame(
602 const cricket::VideoFrame* video_frame) { 602 const cricket::VideoFrame& video_frame) {
603 if (!video_frame)
604 return;
605 603
606 { 604 {
607 AutoLock<VideoRenderer> lock(this); 605 AutoLock<VideoRenderer> lock(this);
608 606
609 const cricket::VideoFrame* frame = 607 const cricket::VideoFrame* frame =
610 video_frame->GetCopyWithRotationApplied(); 608 video_frame.GetCopyWithRotationApplied();
611 609
612 SetSize(static_cast<int>(frame->GetWidth()), 610 SetSize(static_cast<int>(frame->GetWidth()),
613 static_cast<int>(frame->GetHeight())); 611 static_cast<int>(frame->GetHeight()));
614 612
615 ASSERT(image_.get() != NULL); 613 ASSERT(image_.get() != NULL);
616 frame->ConvertToRgbBuffer(cricket::FOURCC_ARGB, 614 frame->ConvertToRgbBuffer(cricket::FOURCC_ARGB,
617 image_.get(), 615 image_.get(),
618 bmi_.bmiHeader.biSizeImage, 616 bmi_.bmiHeader.biSizeImage,
619 bmi_.bmiHeader.biWidth * 617 bmi_.bmiHeader.biWidth *
620 bmi_.bmiHeader.biBitCount / 8); 618 bmi_.bmiHeader.biBitCount / 8);
621 } 619 }
622 InvalidateRect(wnd_, NULL, TRUE); 620 InvalidateRect(wnd_, NULL, TRUE);
623 } 621 }
OLDNEW
« no previous file with comments | « webrtc/examples/peerconnection/client/main_wnd.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698