Index: media/remoting/courier_renderer.h |
diff --git a/media/remoting/remote_renderer_impl.h b/media/remoting/courier_renderer.h |
similarity index 70% |
rename from media/remoting/remote_renderer_impl.h |
rename to media/remoting/courier_renderer.h |
index e23427540c04366b740a780bbf9a0aa3e52acc61..87b462a9ea4f4a0e2824554636582cdb911d9450 100644 |
--- a/media/remoting/remote_renderer_impl.h |
+++ b/media/remoting/courier_renderer.h |
@@ -2,8 +2,8 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef MEDIA_REMOTING_REMOTE_RENDERER_IMPL_H_ |
-#define MEDIA_REMOTING_REMOTE_RENDERER_IMPL_H_ |
+#ifndef MEDIA_REMOTING_COURIER_RENDERER_H_ |
+#define MEDIA_REMOTING_COURIER_RENDERER_H_ |
#include <stdint.h> |
@@ -16,38 +16,40 @@ |
#include "base/optional.h" |
#include "base/synchronization/lock.h" |
#include "base/timer/timer.h" |
-#include "media/base/buffering_state.h" |
#include "media/base/pipeline_status.h" |
#include "media/base/renderer.h" |
-#include "media/base/renderer_client.h" |
#include "media/mojo/interfaces/remoting.mojom.h" |
+#include "media/remoting/interstitial.h" |
#include "media/remoting/metrics.h" |
-#include "media/remoting/remoting_interstitial_ui.h" |
-#include "media/remoting/rpc/rpc_broker.h" |
+#include "media/remoting/rpc_broker.h" |
#include "mojo/public/cpp/system/data_pipe.h" |
+#include "third_party/skia/include/core/SkBitmap.h" |
namespace media { |
-class RemotingRendererController; |
-class Renderer; |
+class RendererClient; |
namespace remoting { |
-class RemoteDemuxerStreamAdapter; |
-}; |
-// A media::Renderer implementation that use a media::Renderer to render |
-// media streams. |
-class RemoteRendererImpl : public Renderer { |
+class DemuxerStreamAdapter; |
+class RendererController; |
+ |
+// A media::Renderer implementation that proxies all operations to a remote |
+// renderer via RPCs. The CourierRenderer is instantiated by |
+// AdaptiveRendererFactory when media remoting is meant to take place. |
+// |
+// While the media content is rendered remotely, the CourierRenderer emits |
+// interstitial frames locally, to the VideoRendererSink, to indicate to the |
+// user that remoting is taking place. |
+class CourierRenderer : public Renderer { |
public: |
// The whole class except for constructor and GetMediaTime() runs on |
// |media_task_runner|. The constructor and GetMediaTime() run on render main |
// thread. |
- RemoteRendererImpl( |
- scoped_refptr<base::SingleThreadTaskRunner> media_task_runner, |
- const base::WeakPtr<RemotingRendererController>& |
- remoting_renderer_controller, |
- VideoRendererSink* video_renderer_sink); |
- ~RemoteRendererImpl() final; |
+ CourierRenderer(scoped_refptr<base::SingleThreadTaskRunner> media_task_runner, |
+ const base::WeakPtr<RendererController>& controller, |
+ VideoRendererSink* video_renderer_sink); |
+ ~CourierRenderer() final; |
private: |
// Callback when attempting to establish data pipe. The function is set to |
@@ -55,8 +57,8 @@ class RemoteRendererImpl : public Renderer { |
// race condition. |
static void OnDataPipeCreatedOnMainThread( |
scoped_refptr<base::SingleThreadTaskRunner> media_task_runner, |
- base::WeakPtr<RemoteRendererImpl> self, |
- base::WeakPtr<remoting::RpcBroker> rpc_broker, |
+ base::WeakPtr<CourierRenderer> self, |
+ base::WeakPtr<RpcBroker> rpc_broker, |
mojom::RemotingDataStreamSenderPtrInfo audio, |
mojom::RemotingDataStreamSenderPtrInfo video, |
mojo::ScopedDataPipeProducerHandle audio_handle, |
@@ -67,22 +69,22 @@ class RemoteRendererImpl : public Renderer { |
// race condition. |
static void OnMessageReceivedOnMainThread( |
scoped_refptr<base::SingleThreadTaskRunner> media_task_runner, |
- base::WeakPtr<RemoteRendererImpl> self, |
- std::unique_ptr<remoting::pb::RpcMessage> message); |
+ base::WeakPtr<CourierRenderer> self, |
+ std::unique_ptr<pb::RpcMessage> message); |
// Callback when remoting interstitial needs to be updated. Will post task to |
// media thread to avoid threading race condition. |
static void RequestUpdateInterstitialOnMainThread( |
scoped_refptr<base::SingleThreadTaskRunner> media_task_runner, |
- base::WeakPtr<RemoteRendererImpl> remote_renderer_impl, |
+ base::WeakPtr<CourierRenderer> self, |
const base::Optional<SkBitmap>& background_image, |
const gfx::Size& canvas_size, |
- RemotingInterstitialType interstitial_type); |
+ InterstitialType interstitial_type); |
public: |
// media::Renderer implementation. |
void Initialize(DemuxerStreamProvider* demuxer_stream_provider, |
- media::RendererClient* client, |
+ RendererClient* client, |
const PipelineStatusCB& init_cb) final; |
void SetCdm(CdmContext* cdm_context, |
const CdmAttachedCB& cdm_attached_cb) final; |
@@ -93,7 +95,7 @@ class RemoteRendererImpl : public Renderer { |
base::TimeDelta GetMediaTime() final; |
private: |
- friend class RemoteRendererImplTest; |
+ friend class CourierRendererTest; |
enum State { |
STATE_UNINITIALIZED, |
@@ -114,30 +116,28 @@ class RemoteRendererImpl : public Renderer { |
int video_rpc_handle); |
// Callback function when RPC message is received. Runs on media thread only. |
- void OnReceivedRpc(std::unique_ptr<remoting::pb::RpcMessage> message); |
+ void OnReceivedRpc(std::unique_ptr<pb::RpcMessage> message); |
// Function to post task to main thread in order to send RPC message. |
- void SendRpcToRemote(std::unique_ptr<remoting::pb::RpcMessage> message); |
+ void SendRpcToRemote(std::unique_ptr<pb::RpcMessage> message); |
// Functions when RPC message is received. |
- void AcquireRendererDone(std::unique_ptr<remoting::pb::RpcMessage> message); |
- void InitializeCallback(std::unique_ptr<remoting::pb::RpcMessage> message); |
+ void AcquireRendererDone(std::unique_ptr<pb::RpcMessage> message); |
+ void InitializeCallback(std::unique_ptr<pb::RpcMessage> message); |
void FlushUntilCallback(); |
- void SetCdmCallback(std::unique_ptr<remoting::pb::RpcMessage> message); |
- void OnTimeUpdate(std::unique_ptr<remoting::pb::RpcMessage> message); |
- void OnBufferingStateChange( |
- std::unique_ptr<remoting::pb::RpcMessage> message); |
- void OnVideoNaturalSizeChange( |
- std::unique_ptr<remoting::pb::RpcMessage> message); |
- void OnVideoOpacityChange(std::unique_ptr<remoting::pb::RpcMessage> message); |
- void OnStatisticsUpdate(std::unique_ptr<remoting::pb::RpcMessage> message); |
- void OnDurationChange(std::unique_ptr<remoting::pb::RpcMessage> message); |
+ void SetCdmCallback(std::unique_ptr<pb::RpcMessage> message); |
+ void OnTimeUpdate(std::unique_ptr<pb::RpcMessage> message); |
+ void OnBufferingStateChange(std::unique_ptr<pb::RpcMessage> message); |
+ void OnVideoNaturalSizeChange(std::unique_ptr<pb::RpcMessage> message); |
+ void OnVideoOpacityChange(std::unique_ptr<pb::RpcMessage> message); |
+ void OnStatisticsUpdate(std::unique_ptr<pb::RpcMessage> message); |
+ void OnDurationChange(std::unique_ptr<pb::RpcMessage> message); |
// Called to update the remoting interstitial. Update |
// |interstitial_background_| if |background_image| is set. |
void UpdateInterstitial(const base::Optional<SkBitmap>& background_image, |
const gfx::Size& canvas_size, |
- RemotingInterstitialType interstitial_type); |
+ InterstitialType interstitial_type); |
// Called when |current_media_time_| is updated. |
void OnMediaTimeUpdated(); |
@@ -151,8 +151,8 @@ class RemoteRendererImpl : public Renderer { |
void ResetMeasurements(); |
// Called when a fatal runtime error occurs. |stop_trigger| is the error code |
- // handed to the RemotingRendererController. |
- void OnFatalError(remoting::StopTrigger stop_trigger); |
+ // handed to the RendererController. |
+ void OnFatalError(StopTrigger stop_trigger); |
// Called periodically to measure the data flows from the |
// DemuxerStreamAdapters and record this information in the metrics. |
@@ -170,17 +170,15 @@ class RemoteRendererImpl : public Renderer { |
base::Lock time_lock_; |
DemuxerStreamProvider* demuxer_stream_provider_; |
- media::RendererClient* client_; |
- std::unique_ptr<remoting::RemoteDemuxerStreamAdapter> |
- audio_demuxer_stream_adapter_; |
- std::unique_ptr<remoting::RemoteDemuxerStreamAdapter> |
- video_demuxer_stream_adapter_; |
+ RendererClient* client_; |
+ std::unique_ptr<DemuxerStreamAdapter> audio_demuxer_stream_adapter_; |
+ std::unique_ptr<DemuxerStreamAdapter> video_demuxer_stream_adapter_; |
// Component to establish mojo remoting service on browser process. |
- const base::WeakPtr<RemotingRendererController> remoting_renderer_controller_; |
+ const base::WeakPtr<RendererController> controller_; |
// Broker class to process incoming and outgoing RPC message. |
- const base::WeakPtr<remoting::RpcBroker> rpc_broker_; |
- // RPC handle value for RemoteRendererImpl component. |
+ const base::WeakPtr<RpcBroker> rpc_broker_; |
+ // RPC handle value for CourierRenderer component. |
const int rpc_handle_; |
// RPC handle value for render on receiver endpoint. |
@@ -225,17 +223,18 @@ class RemoteRendererImpl : public Renderer { |
int times_playback_delayed_ = 0; |
// Records events and measurements of interest. |
- remoting::RendererMetricsRecorder metrics_recorder_; |
+ RendererMetricsRecorder metrics_recorder_; |
- // A timer that polls the RemoteDemuxerStreamAdapters periodically to measure |
+ // A timer that polls the DemuxerStreamAdapters periodically to measure |
// the data flow rates for metrics. |
base::RepeatingTimer data_flow_poll_timer_; |
- base::WeakPtrFactory<RemoteRendererImpl> weak_factory_; |
+ base::WeakPtrFactory<CourierRenderer> weak_factory_; |
- DISALLOW_COPY_AND_ASSIGN(RemoteRendererImpl); |
+ DISALLOW_COPY_AND_ASSIGN(CourierRenderer); |
}; |
+} // namespace remoting |
} // namespace media |
-#endif // MEDIA_REMOTING_REMOTE_RENDERER_IMPL_H_ |
+#endif // MEDIA_REMOTING_COURIER_RENDERER_H_ |