OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MEDIA_REMOTING_END2END_RENDERER_H_ |
| 6 #define MEDIA_REMOTING_END2END_RENDERER_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/memory/weak_ptr.h" |
| 11 #include "media/base/demuxer_stream.h" |
| 12 #include "media/base/renderer.h" |
| 13 #include "media/remoting/rpc_broker.h" |
| 14 |
| 15 namespace media { |
| 16 namespace remoting { |
| 17 |
| 18 class SharedSession; |
| 19 class RendererController; |
| 20 class CourierRenderer; |
| 21 class Receiver; |
| 22 |
| 23 // Simulates the media remoting pipeline. |
| 24 class End2EndTestRenderer final : public Renderer { |
| 25 public: |
| 26 explicit End2EndTestRenderer(std::unique_ptr<Renderer> renderer); |
| 27 ~End2EndTestRenderer() override; |
| 28 |
| 29 // Renderer implementation. |
| 30 void Initialize(MediaResource* media_resource, |
| 31 RendererClient* client, |
| 32 const PipelineStatusCB& init_cb) override; |
| 33 void SetCdm(CdmContext* cdm_context, |
| 34 const CdmAttachedCB& cdm_attached_cb) override; |
| 35 void Flush(const base::Closure& flush_cb) override; |
| 36 void StartPlayingFrom(base::TimeDelta time) override; |
| 37 void SetPlaybackRate(double playback_rate) override; |
| 38 void SetVolume(float volume) override; |
| 39 base::TimeDelta GetMediaTime() override; |
| 40 |
| 41 private: |
| 42 // Called to send RPC messages to |receiver_|. |
| 43 void SendMessageToSink(const std::vector<uint8_t>& message); |
| 44 |
| 45 // Called to send frame data to |receiver_|. |
| 46 void SendFrameToSink(const std::vector<uint8_t>& data, |
| 47 DemuxerStream::Type type); |
| 48 |
| 49 // Called when receives RPC messages from |receiver_|. |
| 50 void OnMessageFromSink(std::unique_ptr<std::vector<uint8_t>> message); |
| 51 |
| 52 // The session that is used by |controller_| to create the data pipes. |
| 53 scoped_refptr<SharedSession> shared_session_; |
| 54 std::unique_ptr<RendererController> controller_; |
| 55 std::unique_ptr<CourierRenderer> courier_renderer_; |
| 56 |
| 57 // The RpcBroker to handle the RPC messages to/from |receiver_|. |
| 58 RpcBroker receiver_rpc_broker_; |
| 59 |
| 60 // A receiver that renders media streams. |
| 61 std::unique_ptr<Receiver> receiver_; |
| 62 |
| 63 base::WeakPtrFactory<End2EndTestRenderer> weak_factory_; |
| 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(End2EndTestRenderer); |
| 66 }; |
| 67 |
| 68 } // namespace remoting |
| 69 } // namespace media |
| 70 |
| 71 #endif // MEDIA_REMOTING_END2END_RENDERER_H_ |
OLD | NEW |