Commit febfdad1 authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

Switch blink::MediaStreamVideoSource away from using gfx::Size

After MediaStream got OnionSoup'ed, some left banned classes
are still being used, eg gfx::Size.

This CL switches MediaStreamVideoSource from using ui::gfx::Size
in favor of blink::IntSize.
It also works as a preparation CL to migrates of the use of base::Bind
to WTF::Bind on the same file/class.

R=jbroman@chromium.org, guidou@chromium.org
CC=blink-reviews-vendor@chromium.org

BUG=923394

Change-Id: I8484fe13c3987fabffe11e9d28eb1782dabb5a7f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1593530
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Commit-Queue: Dmitry Gozman <dgozman@chromium.org>
Auto-Submit: Antonio Gomes <tonikitoo@igalia.com>
Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#656217}
parent 1c6a9143
...@@ -397,7 +397,7 @@ void MediaStreamVideoSource::StartFrameMonitoring() { ...@@ -397,7 +397,7 @@ void MediaStreamVideoSource::StartFrameMonitoring() {
base::Optional<media::VideoCaptureFormat> current_format = GetCurrentFormat(); base::Optional<media::VideoCaptureFormat> current_format = GetCurrentFormat();
double frame_rate = current_format ? current_format->frame_rate : 0.0; double frame_rate = current_format ? current_format->frame_rate : 0.0;
if (current_format && enable_device_rotation_detection_) { if (current_format && enable_device_rotation_detection_) {
track_adapter_->SetSourceFrameSize(current_format->frame_size); track_adapter_->SetSourceFrameSize(IntSize(current_format->frame_size));
} }
track_adapter_->StartFrameMonitoring( track_adapter_->StartFrameMonitoring(
frame_rate, base::Bind(&MediaStreamVideoSource::SetMutedState, frame_rate, base::Bind(&MediaStreamVideoSource::SetMutedState,
......
...@@ -568,7 +568,7 @@ void VideoTrackAdapter::StopFrameMonitoring() { ...@@ -568,7 +568,7 @@ void VideoTrackAdapter::StopFrameMonitoring() {
base::BindOnce(&VideoTrackAdapter::StopFrameMonitoringOnIO, this)); base::BindOnce(&VideoTrackAdapter::StopFrameMonitoringOnIO, this));
} }
void VideoTrackAdapter::SetSourceFrameSize(const gfx::Size& source_frame_size) { void VideoTrackAdapter::SetSourceFrameSize(const IntSize& source_frame_size) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
io_task_runner_->PostTask( io_task_runner_->PostTask(
FROM_HERE, base::BindOnce(&VideoTrackAdapter::SetSourceFrameSizeOnIO, FROM_HERE, base::BindOnce(&VideoTrackAdapter::SetSourceFrameSizeOnIO,
...@@ -664,7 +664,7 @@ void VideoTrackAdapter::StopFrameMonitoringOnIO() { ...@@ -664,7 +664,7 @@ void VideoTrackAdapter::StopFrameMonitoringOnIO() {
} }
void VideoTrackAdapter::SetSourceFrameSizeOnIO( void VideoTrackAdapter::SetSourceFrameSizeOnIO(
const gfx::Size& source_frame_size) { const IntSize& source_frame_size) {
DCHECK(io_task_runner_->BelongsToCurrentThread()); DCHECK(io_task_runner_->BelongsToCurrentThread());
source_frame_size_ = source_frame_size; source_frame_size_ = source_frame_size;
} }
...@@ -717,8 +717,8 @@ void VideoTrackAdapter::DeliverFrameOnIO( ...@@ -717,8 +717,8 @@ void VideoTrackAdapter::DeliverFrameOnIO(
// TODO(guidou): Use actual device information instead of this heuristic to // TODO(guidou): Use actual device information instead of this heuristic to
// detect frames from rotated devices. https://crbug.com/722748 // detect frames from rotated devices. https://crbug.com/722748
if (source_frame_size_ && if (source_frame_size_ &&
frame->natural_size().width() == source_frame_size_->height() && frame->natural_size().width() == source_frame_size_->Height() &&
frame->natural_size().height() == source_frame_size_->width()) { frame->natural_size().height() == source_frame_size_->Width()) {
is_device_rotated = true; is_device_rotated = true;
} }
if (adapters_.IsEmpty()) { if (adapters_.IsEmpty()) {
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "third_party/blink/public/platform/modules/mediastream/media_stream_types.h" #include "third_party/blink/public/platform/modules/mediastream/media_stream_types.h"
#include "third_party/blink/public/platform/web_common.h" #include "third_party/blink/public/platform/web_common.h"
#include "third_party/blink/public/web/modules/mediastream/media_stream_video_track.h" #include "third_party/blink/public/web/modules/mediastream/media_stream_video_track.h"
#include "third_party/blink/renderer/platform/geometry/int_size.h"
#include "third_party/blink/renderer/platform/wtf/thread_safe_ref_counted.h" #include "third_party/blink/renderer/platform/wtf/thread_safe_ref_counted.h"
#include "third_party/blink/renderer/platform/wtf/vector.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
...@@ -74,7 +75,7 @@ class BLINK_EXPORT VideoTrackAdapter ...@@ -74,7 +75,7 @@ class BLINK_EXPORT VideoTrackAdapter
const OnMutedCallback& on_muted_callback); const OnMutedCallback& on_muted_callback);
void StopFrameMonitoring(); void StopFrameMonitoring();
void SetSourceFrameSize(const gfx::Size& source_frame_size); void SetSourceFrameSize(const IntSize& source_frame_size);
// Exported for testing. // Exported for testing.
// //
...@@ -103,7 +104,7 @@ class BLINK_EXPORT VideoTrackAdapter ...@@ -103,7 +104,7 @@ class BLINK_EXPORT VideoTrackAdapter
void StartFrameMonitoringOnIO(const OnMutedCallback& on_muted_state_callback, void StartFrameMonitoringOnIO(const OnMutedCallback& on_muted_state_callback,
double source_frame_rate); double source_frame_rate);
void StopFrameMonitoringOnIO(); void StopFrameMonitoringOnIO();
void SetSourceFrameSizeOnIO(const gfx::Size& frame_size); void SetSourceFrameSizeOnIO(const IntSize& frame_size);
// Compare |frame_counter_snapshot| with the current |frame_counter_|, and // Compare |frame_counter_snapshot| with the current |frame_counter_|, and
// inform of the situation (muted, not muted) via |set_muted_state_callback|. // inform of the situation (muted, not muted) via |set_muted_state_callback|.
...@@ -144,7 +145,7 @@ class BLINK_EXPORT VideoTrackAdapter ...@@ -144,7 +145,7 @@ class BLINK_EXPORT VideoTrackAdapter
float source_frame_rate_; float source_frame_rate_;
// Resolution configured on the video source, accessed on the IO-thread. // Resolution configured on the video source, accessed on the IO-thread.
base::Optional<gfx::Size> source_frame_size_; base::Optional<IntSize> source_frame_size_;
DISALLOW_COPY_AND_ASSIGN(VideoTrackAdapter); DISALLOW_COPY_AND_ASSIGN(VideoTrackAdapter);
}; };
......
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