Commit 106d17cb authored by Guido Urdaneta's avatar Guido Urdaneta Committed by Commit Bot

Check that request is valid after getting video formats on UserMediaProcessor.

Bug: 816323
Change-Id: I5345d13037105374ad8ca062e8c55a4dec13d9e4
Reviewed-on: https://chromium-review.googlesource.com/937222
Commit-Queue: Guido Urdaneta <guidou@chromium.org>
Reviewed-by: default avatarChandan Padhi <c.padhi@samsung.com>
Cr-Commit-Position: refs/heads/master@{#539120}
parent 7e894632
...@@ -686,16 +686,24 @@ void UserMediaProcessor::OnStreamGenerated( ...@@ -686,16 +686,24 @@ void UserMediaProcessor::OnStreamGenerated(
GetMediaDevicesDispatcher()->GetAllVideoInputDeviceFormats( GetMediaDevicesDispatcher()->GetAllVideoInputDeviceFormats(
video_device.id, video_device.id,
base::BindOnce(&UserMediaProcessor::GotAllVideoInputFormatsForDevice, base::BindOnce(&UserMediaProcessor::GotAllVideoInputFormatsForDevice,
weak_factory_.GetWeakPtr(), label, video_device.id)); weak_factory_.GetWeakPtr(),
current_request_info_->web_request(), label,
video_device.id));
} }
} }
void UserMediaProcessor::GotAllVideoInputFormatsForDevice( void UserMediaProcessor::GotAllVideoInputFormatsForDevice(
const blink::WebUserMediaRequest& web_request,
const std::string& label, const std::string& label,
const std::string& device_id, const std::string& device_id,
const media::VideoCaptureFormats& formats) { const media::VideoCaptureFormats& formats) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(current_request_info_); // The frame might reload or |web_request| might be cancelled while video
// formats are queried. Do nothing if a different request is being processed
// at this point.
if (!IsCurrentRequestInfo(web_request))
return;
current_request_info_->AddVideoFormats(device_id, formats); current_request_info_->AddVideoFormats(device_id, formats);
if (current_request_info_->CanStartTracks()) if (current_request_info_->CanStartTracks())
StartTracks(label); StartTracks(label);
......
...@@ -148,6 +148,7 @@ class CONTENT_EXPORT UserMediaProcessor ...@@ -148,6 +148,7 @@ class CONTENT_EXPORT UserMediaProcessor
const MediaStreamDevices& video_devices); const MediaStreamDevices& video_devices);
void GotAllVideoInputFormatsForDevice( void GotAllVideoInputFormatsForDevice(
const blink::WebUserMediaRequest& web_request,
const std::string& label, const std::string& label,
const std::string& device_id, const std::string& device_id,
const media::VideoCaptureFormats& formats); const media::VideoCaptureFormats& formats);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment