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

Side by Side Diff: content/renderer/media/rtc_video_capture_delegate.cc

Issue 23587018: Replace media::VideoCapture::VideoFrameBuffer with media::VideoFrame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@git-svn
Patch Set: 727f973e fischman@ comments Created 7 years, 3 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/rtc_video_capture_delegate.h" 5 #include "content/renderer/media/rtc_video_capture_delegate.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 8
9 namespace content { 9 namespace content {
10 10
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 FROM_HERE, 74 FROM_HERE,
75 base::Bind(&RtcVideoCaptureDelegate::OnRemovedOnCaptureThread, 75 base::Bind(&RtcVideoCaptureDelegate::OnRemovedOnCaptureThread,
76 this, capture)); 76 this, capture));
77 77
78 // Balance the AddRef in StartCapture. 78 // Balance the AddRef in StartCapture.
79 // This means we are no longer registered as an event handler and can safely 79 // This means we are no longer registered as an event handler and can safely
80 // be deleted. 80 // be deleted.
81 Release(); 81 Release();
82 } 82 }
83 83
84 void RtcVideoCaptureDelegate::OnBufferReady( 84 void RtcVideoCaptureDelegate::OnFrameReady(
85 media::VideoCapture* capture, 85 media::VideoCapture* capture,
86 scoped_refptr<media::VideoCapture::VideoFrameBuffer> buf) { 86 const scoped_refptr<media::VideoFrame>& frame) {
87 message_loop_proxy_->PostTask( 87 message_loop_proxy_->PostTask(
88 FROM_HERE, 88 FROM_HERE,
89 base::Bind(&RtcVideoCaptureDelegate::OnBufferReadyOnCaptureThread, 89 base::Bind(&RtcVideoCaptureDelegate::OnFrameReadyOnCaptureThread,
90 this, capture, buf)); 90 this,
91 capture,
92 frame));
91 } 93 }
92 94
93 void RtcVideoCaptureDelegate::OnDeviceInfoReceived( 95 void RtcVideoCaptureDelegate::OnDeviceInfoReceived(
94 media::VideoCapture* capture, 96 media::VideoCapture* capture,
95 const media::VideoCaptureParams& device_info) { 97 const media::VideoCaptureParams& device_info) {
96 } 98 }
97 99
98 void RtcVideoCaptureDelegate::OnDeviceInfoChanged( 100 void RtcVideoCaptureDelegate::OnDeviceInfoChanged(
99 media::VideoCapture* capture, 101 media::VideoCapture* capture,
100 const media::VideoCaptureParams& device_info) { 102 const media::VideoCaptureParams& device_info) {
101 } 103 }
102 104
103 void RtcVideoCaptureDelegate::OnBufferReadyOnCaptureThread( 105 void RtcVideoCaptureDelegate::OnFrameReadyOnCaptureThread(
104 media::VideoCapture* capture, 106 media::VideoCapture* capture,
105 scoped_refptr<media::VideoCapture::VideoFrameBuffer> buf) { 107 const scoped_refptr<media::VideoFrame>& frame) {
106 if (!captured_callback_.is_null()) { 108 if (!captured_callback_.is_null()) {
107 if (!got_first_frame_) { 109 if (!got_first_frame_) {
108 got_first_frame_ = true; 110 got_first_frame_ = true;
109 if (!state_callback_.is_null()) 111 if (!state_callback_.is_null())
110 state_callback_.Run(CAPTURE_RUNNING); 112 state_callback_.Run(CAPTURE_RUNNING);
111 } 113 }
112 114
113 captured_callback_.Run(*buf.get()); 115 captured_callback_.Run(frame);
114 } 116 }
115 capture->FeedBuffer(buf);
116 } 117 }
117 118
118 void RtcVideoCaptureDelegate::OnErrorOnCaptureThread( 119 void RtcVideoCaptureDelegate::OnErrorOnCaptureThread(
119 media::VideoCapture* capture) { 120 media::VideoCapture* capture) {
120 error_occured_ = true; 121 error_occured_ = true;
121 if (!state_callback_.is_null()) 122 if (!state_callback_.is_null())
122 state_callback_.Run(CAPTURE_FAILED); 123 state_callback_.Run(CAPTURE_FAILED);
123 } 124 }
124 125
125 126
126 void RtcVideoCaptureDelegate::OnRemovedOnCaptureThread( 127 void RtcVideoCaptureDelegate::OnRemovedOnCaptureThread(
127 media::VideoCapture* capture) { 128 media::VideoCapture* capture) {
128 if (!error_occured_ && !state_callback_.is_null()) 129 if (!error_occured_ && !state_callback_.is_null())
129 state_callback_.Run(CAPTURE_STOPPED); 130 state_callback_.Run(CAPTURE_STOPPED);
130 } 131 }
131 132
132 } // namespace content 133 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698