#include "content/browser/media/capture/desktop_capture_device_uma_types.h"
#include "content/common/gpu/client/gl_helper.h"
#include "content/public/browser/browser_thread.h"
-#include "media/base/bind_to_current_loop.h"
#include "media/base/video_util.h"
#include "media/video/capture/video_capture_types.h"
#include "skia/ext/image_operations.h"
desktop_window_->GetHost()->compositor()->AddObserver(this);
// Starts timer.
- timer_.Start(FROM_HERE, oracle_proxy_->capture_period(),
+ timer_.Start(FROM_HERE, oracle_proxy_->min_capture_period(),
base::Bind(&DesktopVideoCaptureMachine::Capture, AsWeakPtr(),
false));
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (oracle_proxy_ && desktop_window_) {
ui::Layer* layer = desktop_window_->layer();
- oracle_proxy_->UpdateCaptureSize(ui::ConvertSizeToPixel(
- layer, layer->bounds().size()));
+ gfx::Size capture_size =
+ ui::ConvertSizeToPixel(layer, layer->bounds().size());
+#if defined(OS_CHROMEOS)
+ // Pad desktop capture size to multiples of 16 pixels to accommodate HW
+ // encoder. TODO(hshi): remove this hack. See http://crbug.com/402151
+ capture_size.SetSize((capture_size.width() + 15) & ~15,
+ (capture_size.height() + 15) & ~15);
+#endif
+ oracle_proxy_->UpdateCaptureSize(capture_size);
}
ClearCursorState();
}
dirty ? VideoCaptureOracle::kCompositorUpdate
: VideoCaptureOracle::kTimerPoll;
if (oracle_proxy_->ObserveEventAndDecideCapture(
- event, start_time, &frame, &capture_frame_cb)) {
+ event, gfx::Rect(), start_time, &frame, &capture_frame_cb)) {
scoped_ptr<cc::CopyOutputRequest> request =
cc::CopyOutputRequest::CreateRequest(
base::Bind(&DesktopVideoCaptureMachine::DidCopyOutput,
AsWeakPtr(), frame, start_time, capture_frame_cb));
- gfx::Rect window_rect =
- ui::ConvertRectToPixel(desktop_window_->layer(),
- gfx::Rect(desktop_window_->bounds().width(),
- desktop_window_->bounds().height()));
+ gfx::Rect window_rect = gfx::Rect(desktop_window_->bounds().width(),
+ desktop_window_->bounds().height());
request->set_area(window_rect);
desktop_window_->layer()->RequestCopyOfOutput(request.Pass());
}
}
void RunSingleReleaseCallback(scoped_ptr<cc::SingleReleaseCallback> cb,
- const std::vector<uint32>& sync_points) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper();
- DCHECK(gl_helper);
- for (unsigned i = 0; i < sync_points.size(); i++)
- gl_helper->WaitSyncPoint(sync_points[i]);
- uint32 new_sync_point = gl_helper->InsertSyncPoint();
- cb->Run(new_sync_point, false);
+ uint32 sync_point) {
+ cb->Run(sync_point, false);
}
void DesktopVideoCaptureMachine::DidCopyOutput(
} else {
IncrementDesktopCaptureCounter(succeeded
? FIRST_WINDOW_CAPTURE_SUCCEEDED
- : FIRST_WINDOW_CAPTURE_SUCCEEDED);
+ : FIRST_WINDOW_CAPTURE_FAILED);
}
}
}
make_scoped_ptr(new gpu::MailboxHolder(texture_mailbox.mailbox(),
texture_mailbox.target(),
texture_mailbox.sync_point())),
- media::BindToCurrentLoop(base::Bind(&RunSingleReleaseCallback,
- base::Passed(&release_callback))),
+ base::Bind(&RunSingleReleaseCallback, base::Passed(&release_callback)),
result->size(),
gfx::Rect(result->size()),
result->size(),
const DesktopMediaID& source) {
IncrementDesktopCaptureCounter(source.type == DesktopMediaID::TYPE_SCREEN
? SCREEN_CAPTURER_CREATED
- : WINDOW_CATPTURER_CREATED);
+ : WINDOW_CAPTURER_CREATED);
return new DesktopCaptureDeviceAura(source);
}