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

Side by Side Diff: media/remoting/remote_renderer_impl.cc

Issue 2648423004: Revert of Media Remoting: Don't exit remoting if no enough data buffered. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « media/remoting/remote_renderer_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "media/remoting/remote_renderer_impl.h" 5 #include "media/remoting/remote_renderer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 OnFatalError(remoting::RPC_INVALID); 583 OnFatalError(remoting::RPC_INVALID);
584 return; 584 return;
585 } 585 }
586 VLOG(2) << __func__ << ": Received RPC_RC_ONBUFFERINGSTATECHANGE with state=" 586 VLOG(2) << __func__ << ": Received RPC_RC_ONBUFFERINGSTATECHANGE with state="
587 << message->rendererclient_onbufferingstatechange_rpc().state(); 587 << message->rendererclient_onbufferingstatechange_rpc().state();
588 base::Optional<::media::BufferingState> state = 588 base::Optional<::media::BufferingState> state =
589 remoting::ToMediaBufferingState( 589 remoting::ToMediaBufferingState(
590 message->rendererclient_onbufferingstatechange_rpc().state()); 590 message->rendererclient_onbufferingstatechange_rpc().state());
591 if (!state.has_value()) 591 if (!state.has_value())
592 return; 592 return;
593 if (state == BufferingState::BUFFERING_HAVE_NOTHING) {
594 is_waiting_for_buffering_ = true;
595 } else if (is_waiting_for_buffering_) {
596 is_waiting_for_buffering_ = false;
597 ResetMeasurements();
598 }
599
600 client_->OnBufferingStateChange(state.value()); 593 client_->OnBufferingStateChange(state.value());
601 } 594 }
602 595
603 void RemoteRendererImpl::OnVideoNaturalSizeChange( 596 void RemoteRendererImpl::OnVideoNaturalSizeChange(
604 std::unique_ptr<remoting::pb::RpcMessage> message) { 597 std::unique_ptr<remoting::pb::RpcMessage> message) {
605 DCHECK(media_task_runner_->BelongsToCurrentThread()); 598 DCHECK(media_task_runner_->BelongsToCurrentThread());
606 DCHECK(message); 599 DCHECK(message);
607 // Shutdown remoting session if receiving malformed RPC message. 600 // Shutdown remoting session if receiving malformed RPC message.
608 if (!message->has_rendererclient_onvideonatualsizechange_rpc()) { 601 if (!message->has_rendererclient_onvideonatualsizechange_rpc()) {
609 VLOG(1) << __func__ << " missing required RPC message"; 602 VLOG(1) << __func__ << " missing required RPC message";
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 interstitial_background_ = background_image.value(); 720 interstitial_background_ = background_image.value();
728 canvas_size_ = canvas_size; 721 canvas_size_ = canvas_size;
729 PaintRemotingInterstitial(interstitial_background_, canvas_size_, 722 PaintRemotingInterstitial(interstitial_background_, canvas_size_,
730 interstitial_type, video_renderer_sink_); 723 interstitial_type, video_renderer_sink_);
731 } 724 }
732 725
733 void RemoteRendererImpl::OnMediaTimeUpdated() { 726 void RemoteRendererImpl::OnMediaTimeUpdated() {
734 DCHECK(media_task_runner_->BelongsToCurrentThread()); 727 DCHECK(media_task_runner_->BelongsToCurrentThread());
735 if (!flush_cb_.is_null()) 728 if (!flush_cb_.is_null())
736 return; // Don't manage and check the queue when Flush() is on-going. 729 return; // Don't manage and check the queue when Flush() is on-going.
737 if (is_waiting_for_buffering_)
738 return; // Don't manage and check the queue when buffering is on-going.
739 730
740 base::TimeTicks current_time = base::TimeTicks::Now(); 731 base::TimeTicks current_time = base::TimeTicks::Now();
741 if (current_time < ignore_updates_until_time_) 732 if (current_time < ignore_updates_until_time_)
742 return; // Not stable yet. 733 return; // Not stable yet.
743 734
744 media_time_queue_.push_back( 735 media_time_queue_.push_back(
745 std::make_pair(current_time, current_media_time_)); 736 std::make_pair(current_time, current_media_time_));
746 base::TimeDelta window_duration = 737 base::TimeDelta window_duration =
747 current_time - media_time_queue_.front().first; 738 current_time - media_time_queue_.front().first;
748 if (window_duration < kTrackingWindow) 739 if (window_duration < kTrackingWindow)
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 kDataFlowPollPeriod.InSecondsF()) / 857 kDataFlowPollPeriod.InSecondsF()) /
867 kBytesPerKilobit; 858 kBytesPerKilobit;
868 DCHECK_GE(kilobits_per_second, 0); 859 DCHECK_GE(kilobits_per_second, 0);
869 const base::CheckedNumeric<int> checked_kbps = kilobits_per_second; 860 const base::CheckedNumeric<int> checked_kbps = kilobits_per_second;
870 metrics_recorder_.OnVideoRateEstimate( 861 metrics_recorder_.OnVideoRateEstimate(
871 checked_kbps.ValueOrDefault(std::numeric_limits<int>::max())); 862 checked_kbps.ValueOrDefault(std::numeric_limits<int>::max()));
872 } 863 }
873 } 864 }
874 865
875 } // namespace media 866 } // namespace media
OLDNEW
« no previous file with comments | « media/remoting/remote_renderer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698