Commit 472574d9 authored by Guido Urdaneta's avatar Guido Urdaneta Committed by Commit Bot

Remove PushableMediaStreamVideoSource::Stop()

Replace callsites with StopSource(), inherited from
MediaStreamVideoSource.
Also add a running() accessor, for better state tracking.

Bug: 1142955
Change-Id: Ib197b9b696d8b8b0a75d504a5c92135fd4185280
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2504236
Commit-Queue: Thomas Guilbert <tguilbert@chromium.org>
Reviewed-by: default avatarThomas Guilbert <tguilbert@chromium.org>
Cr-Commit-Position: refs/heads/master@{#822274}
parent 0d9923f4
...@@ -33,12 +33,6 @@ void PushableMediaStreamVideoSource::PushFrame( ...@@ -33,12 +33,6 @@ void PushableMediaStreamVideoSource::PushFrame(
estimated_capture_time)); estimated_capture_time));
} }
void PushableMediaStreamVideoSource::Stop() {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DoStopSource();
running_ = false;
}
void PushableMediaStreamVideoSource::StartSourceImpl( void PushableMediaStreamVideoSource::StartSourceImpl(
VideoCaptureDeliverFrameCB frame_callback, VideoCaptureDeliverFrameCB frame_callback,
EncodedVideoFrameCB encoded_frame_callback) { EncodedVideoFrameCB encoded_frame_callback) {
......
...@@ -26,9 +26,7 @@ class MODULES_EXPORT PushableMediaStreamVideoSource ...@@ -26,9 +26,7 @@ class MODULES_EXPORT PushableMediaStreamVideoSource
// media::VideoFrame::timestamp(). // media::VideoFrame::timestamp().
void PushFrame(scoped_refptr<media::VideoFrame> video_frame, void PushFrame(scoped_refptr<media::VideoFrame> video_frame,
base::TimeTicks estimated_capture_time); base::TimeTicks estimated_capture_time);
// TODO(crbug.com/1142955): Remove this method. StopSource() should be used bool running() const { return running_; }
// instead.
void Stop();
// MediaStreamVideoSource // MediaStreamVideoSource
void StartSourceImpl(VideoCaptureDeliverFrameCB frame_callback, void StartSourceImpl(VideoCaptureDeliverFrameCB frame_callback,
......
...@@ -91,15 +91,18 @@ class PushableMediaStreamVideoSourceTest : public testing::Test { ...@@ -91,15 +91,18 @@ class PushableMediaStreamVideoSourceTest : public testing::Test {
TEST_F(PushableMediaStreamVideoSourceTest, StartAndStop) { TEST_F(PushableMediaStreamVideoSourceTest, StartAndStop) {
EXPECT_EQ(MediaStreamSource::kReadyStateLive, EXPECT_EQ(MediaStreamSource::kReadyStateLive,
stream_source_->GetReadyState()); stream_source_->GetReadyState());
EXPECT_FALSE(pushable_video_source_->running());
WebMediaStreamTrack track = StartSource(); WebMediaStreamTrack track = StartSource();
EXPECT_EQ(MediaStreamSource::kReadyStateLive, EXPECT_EQ(MediaStreamSource::kReadyStateLive,
stream_source_->GetReadyState()); stream_source_->GetReadyState());
EXPECT_TRUE(pushable_video_source_->running());
// If the pushable source stops, the MediaStreamSource should stop. // If the pushable source stops, the MediaStreamSource should stop.
pushable_video_source_->StopSource(); pushable_video_source_->StopSource();
EXPECT_EQ(MediaStreamSource::kReadyStateEnded, EXPECT_EQ(MediaStreamSource::kReadyStateEnded,
stream_source_->GetReadyState()); stream_source_->GetReadyState());
EXPECT_FALSE(pushable_video_source_->running());
} }
TEST_F(PushableMediaStreamVideoSourceTest, FramesPropagateToSink) { TEST_F(PushableMediaStreamVideoSourceTest, FramesPropagateToSink) {
......
...@@ -65,13 +65,13 @@ class VideoTrackWritableStreamSink final : public UnderlyingSinkBase { ...@@ -65,13 +65,13 @@ class VideoTrackWritableStreamSink final : public UnderlyingSinkBase {
ScriptPromise abort(ScriptState* script_state, ScriptPromise abort(ScriptState* script_state,
ScriptValue reason, ScriptValue reason,
ExceptionState& exception_state) override { ExceptionState& exception_state) override {
source_->Stop(); source_->StopSource();
return ScriptPromise::CastUndefined(script_state); return ScriptPromise::CastUndefined(script_state);
} }
ScriptPromise close(ScriptState* script_state, ScriptPromise close(ScriptState* script_state,
ExceptionState& exception_state) override { ExceptionState& exception_state) override {
source_->Stop(); source_->StopSource();
return ScriptPromise::CastUndefined(script_state); return ScriptPromise::CastUndefined(script_state);
} }
......
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