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

Side by Side Diff: chromecast/media/cma/backend/media_component_device_default.h

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

Powered by Google App Engine
This is Rietveld 408576698