OLD | NEW |
| (Empty) |
1 // Copyright 2015 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 CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_COMPONENT_DEVICE_DEFAULT_H_ | |
6 #define CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_COMPONENT_DEVICE_DEFAULT_H_ | |
7 | |
8 #include <list> | |
9 | |
10 #include "base/macros.h" | |
11 #include "base/memory/weak_ptr.h" | |
12 #include "base/threading/thread_checker.h" | |
13 | |
14 #include "chromecast/public/media/media_clock_device.h" | |
15 #include "chromecast/public/media/media_component_device.h" | |
16 | |
17 namespace chromecast { | |
18 class TaskRunner; | |
19 | |
20 namespace media { | |
21 struct MediaPipelineDeviceParams; | |
22 | |
23 class MediaComponentDeviceDefault : public MediaComponentDevice { | |
24 public: | |
25 MediaComponentDeviceDefault(const MediaPipelineDeviceParams& params, | |
26 MediaClockDevice* media_clock_device); | |
27 ~MediaComponentDeviceDefault() override; | |
28 | |
29 // MediaComponentDevice implementation. | |
30 void SetClient(Client* client) override; | |
31 State GetState() const override; | |
32 bool SetState(State new_state) override; | |
33 bool SetStartPts(int64_t time_microseconds) override; | |
34 FrameStatus PushFrame(DecryptContext* decrypt_context, | |
35 CastDecoderBuffer* buffer, | |
36 FrameStatusCB* completion_cb) override; | |
37 RenderingDelay GetRenderingDelay() const override; | |
38 bool GetStatistics(Statistics* stats) const override; | |
39 | |
40 private: | |
41 struct DefaultDecoderBuffer { | |
42 DefaultDecoderBuffer(); | |
43 ~DefaultDecoderBuffer(); | |
44 | |
45 // Buffer size. | |
46 size_t size; | |
47 | |
48 // Presentation timestamp. | |
49 base::TimeDelta pts; | |
50 }; | |
51 | |
52 void RenderTask(); | |
53 | |
54 TaskRunner* task_runner_; | |
55 MediaClockDevice* const media_clock_device_; | |
56 scoped_ptr<Client> client_; | |
57 | |
58 State state_; | |
59 | |
60 // Indicate whether the end of stream has been received. | |
61 bool is_eos_; | |
62 | |
63 // Media time of the last rendered audio sample. | |
64 base::TimeDelta rendering_time_; | |
65 | |
66 // Frame decoded/rendered since the pipeline left the idle state. | |
67 uint64 decoded_frame_count_; | |
68 uint64 decoded_byte_count_; | |
69 | |
70 // List of frames not rendered yet. | |
71 std::list<DefaultDecoderBuffer> frames_; | |
72 | |
73 // Indicate whether there is a scheduled rendering task. | |
74 bool scheduled_rendering_task_; | |
75 | |
76 // Pending frame. | |
77 scoped_ptr<CastDecoderBuffer> pending_buffer_; | |
78 scoped_ptr<FrameStatusCB> frame_pushed_cb_; | |
79 | |
80 base::ThreadChecker thread_checker_; | |
81 | |
82 base::WeakPtr<MediaComponentDeviceDefault> weak_this_; | |
83 base::WeakPtrFactory<MediaComponentDeviceDefault> weak_factory_; | |
84 | |
85 DISALLOW_COPY_AND_ASSIGN(MediaComponentDeviceDefault); | |
86 }; | |
87 | |
88 } // namespace media | |
89 } // namespace chromecast | |
90 | |
91 #endif // CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_COMPONENT_DEVICE_DEFAULT_H_ | |
OLD | NEW |