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

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: 4fe79a572 Initial. 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 FROM_HERE, 75 FROM_HERE,
76 base::Bind(&RtcVideoCaptureDelegate::OnRemovedOnCaptureThread, 76 base::Bind(&RtcVideoCaptureDelegate::OnRemovedOnCaptureThread,
77 this, capture)); 77 this, capture));
78 78
79 // Balance the AddRef in StartCapture. 79 // Balance the AddRef in StartCapture.
80 // This means we are no longer registered as an event handler and can safely 80 // This means we are no longer registered as an event handler and can safely
81 // be deleted. 81 // be deleted.
82 Release(); 82 Release();
83 } 83 }
84 84
85 void RtcVideoCaptureDelegate::OnBufferReady( 85 void RtcVideoCaptureDelegate::OnFrameReady(
86 media::VideoCapture* capture, 86 media::VideoCapture* capture,
87 scoped_refptr<media::VideoCapture::VideoFrameBuffer> buf) { 87 const scoped_refptr<media::VideoFrame>& frame) {
88 message_loop_proxy_->PostTask( 88 message_loop_proxy_->PostTask(
89 FROM_HERE, 89 FROM_HERE,
90 base::Bind(&RtcVideoCaptureDelegate::OnBufferReadyOnCaptureThread, 90 base::Bind(&RtcVideoCaptureDelegate::OnFrameReadyOnCaptureThread,
91 this, capture, buf)); 91 this,
92 capture,
93 frame));
92 } 94 }
93 95
94 void RtcVideoCaptureDelegate::OnDeviceInfoReceived( 96 void RtcVideoCaptureDelegate::OnDeviceInfoReceived(
95 media::VideoCapture* capture, 97 media::VideoCapture* capture,
96 const media::VideoCaptureParams& device_info) { 98 const media::VideoCaptureParams& device_info) {
97 NOTIMPLEMENTED(); 99 NOTIMPLEMENTED();
98 } 100 }
99 101
100 void RtcVideoCaptureDelegate::OnDeviceInfoChanged( 102 void RtcVideoCaptureDelegate::OnDeviceInfoChanged(
101 media::VideoCapture* capture, 103 media::VideoCapture* capture,
102 const media::VideoCaptureParams& device_info) { 104 const media::VideoCaptureParams& device_info) {
103 NOTIMPLEMENTED(); 105 NOTIMPLEMENTED();
104 } 106 }
105 107
106 void RtcVideoCaptureDelegate::OnBufferReadyOnCaptureThread( 108 void RtcVideoCaptureDelegate::OnFrameReadyOnCaptureThread(
107 media::VideoCapture* capture, 109 media::VideoCapture* capture,
108 scoped_refptr<media::VideoCapture::VideoFrameBuffer> buf) { 110 const scoped_refptr<media::VideoFrame>& frame) {
109 if (!captured_callback_.is_null()) { 111 if (!captured_callback_.is_null()) {
110 if (!got_first_frame_) { 112 if (!got_first_frame_) {
111 got_first_frame_ = true; 113 got_first_frame_ = true;
112 if (!state_callback_.is_null()) 114 if (!state_callback_.is_null())
113 state_callback_.Run(CAPTURE_RUNNING); 115 state_callback_.Run(CAPTURE_RUNNING);
114 } 116 }
115 117
116 captured_callback_.Run(*buf.get()); 118 captured_callback_.Run(frame);
117 } 119 }
118 capture->FeedBuffer(buf);
119 } 120 }
120 121
121 void RtcVideoCaptureDelegate::OnErrorOnCaptureThread( 122 void RtcVideoCaptureDelegate::OnErrorOnCaptureThread(
122 media::VideoCapture* capture) { 123 media::VideoCapture* capture) {
123 error_occured_ = true; 124 error_occured_ = true;
124 if (!state_callback_.is_null()) 125 if (!state_callback_.is_null())
125 state_callback_.Run(CAPTURE_FAILED); 126 state_callback_.Run(CAPTURE_FAILED);
126 } 127 }
127 128
128 129
129 void RtcVideoCaptureDelegate::OnRemovedOnCaptureThread( 130 void RtcVideoCaptureDelegate::OnRemovedOnCaptureThread(
130 media::VideoCapture* capture) { 131 media::VideoCapture* capture) {
131 if (!error_occured_ && !state_callback_.is_null()) 132 if (!error_occured_ && !state_callback_.is_null())
132 state_callback_.Run(CAPTURE_STOPPED); 133 state_callback_.Run(CAPTURE_STOPPED);
133 } 134 }
134 135
135 } // namespace content 136 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698