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

Side by Side Diff: media/mojo/clients/mojo_demuxer.h

Issue 2643743002: Mojify demuxers and allow running {Chunk/FFmpeg}Demuxer in a Utility Process (Closed)
Patch Set: Rebase and make sure to unbind mojom::DemuxerPtr on the bound thread during termination Created 3 years, 10 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/mojo/clients/mojo_data_source_impl.cc ('k') | media/mojo/clients/mojo_demuxer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 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_MOJO_CLIENTS_MOJO_DEMUXER_H_
6 #define MEDIA_MOJO_CLIENTS_MOJO_DEMUXER_H_
7
8 #include "media/base/demuxer.h"
9 #include "media/base/demuxer_stream.h"
10 #include "media/mojo/interfaces/demuxer.mojom.h"
11 #include "mojo/public/cpp/bindings/associated_binding.h"
12
13 namespace media {
14
15 class DataSource;
16 class MojoDataSourceImpl;
17
18 class MojoDemuxer : public Demuxer, public mojom::DemuxerClient {
19 public:
20 MojoDemuxer(
21 int32_t remote_id,
22 Demuxer::LoadType load_type,
23 DataSource* data_source,
24 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner,
25 mojom::DemuxerPtr mojo_demuxer,
26 const base::Closure& open_cb,
27 const Demuxer::EncryptedMediaInitDataCB& encrypted_media_init_data_cb,
28 const Demuxer::MediaTracksUpdatedCB& media_tracks_updated_cb);
29 ~MojoDemuxer() override;
30
31 // MediaResource interface.
32 DemuxerStream* GetStream(DemuxerStream::Type type) override;
33 MediaResource::Type GetType() const override;
34
35 // Demuxer interface.
36 std::string GetDisplayName() const override;
37 void Initialize(DemuxerHost* host,
38 const PipelineStatusCB& status_cb,
39 bool enable_text_tracks) override;
40 void StartWaitingForSeek(base::TimeDelta seek_time) override;
41 void CancelPendingSeek(base::TimeDelta seek_time) override;
42 void Seek(base::TimeDelta time, const PipelineStatusCB& status_cb) override;
43 void Stop() override;
44 void AbortPendingReads() override;
45 base::TimeDelta GetStartTime() const override;
46 base::Time GetTimelineOffset() const override;
47 int64_t GetMemoryUsage() const override;
48 void OnEnabledAudioTracksChanged(const std::vector<MediaTrack::Id>& track_ids,
49 base::TimeDelta current_time) override;
50 void OnSelectedVideoTrackChanged(const std::vector<MediaTrack::Id>& track_ids,
51 base::TimeDelta current_time) override;
52
53 // mojom::DemuxerClient implementation.
54 void OnEncryptedMediaInitData(EmeInitDataType init_data_type,
55 const std::vector<uint8_t>& init_data) final;
56 void OnMediaTracksUpdated(mojom::MediaTracksPtr mojo_tracks) final;
57 void OnBufferedTimeRangesChanged(mojom::RangesTimeDeltaPtr mojo_ranges) final;
58 void OnSetDuration(base::TimeDelta duration) final;
59 void OnDemuxerError(PipelineStatus error) final;
60
61 protected:
62 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_;
63
64 private:
65 void OnDataSourceConnectionError();
66 void OnInitialized(bool success);
67 void OnSeek(const PipelineStatusCB& status_cb, PipelineStatus status);
68 void OnConnectionError();
69
70 Demuxer::LoadType load_type_;
71
72 std::unique_ptr<MojoDataSourceImpl> mojo_data_source_;
73 DataSource* data_source_;
74
75 base::Closure open_cb_;
76 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb_;
77 Demuxer::MediaTracksUpdatedCB media_tracks_updated_cb_;
78 PipelineStatusCB status_cb_;
79
80 DemuxerHost* host_;
81
82 // This class is constructed on one thread and used exclusively on another
83 // thread. This member is used to safely pass the DemuxerPtr from one thread
84 // to another. It is set in the constructor and is consumed in Initialize().
85 mojom::DemuxerPtrInfo remote_demuxer_info_;
86
87 mojom::DemuxerPtr remote_demuxer_;
88
89 // Binding for DemuxerClient, bound to the |media_task_runner_|.
90 mojo::AssociatedBinding<DemuxerClient> client_binding_;
91
92 base::WeakPtrFactory<MojoDemuxer> weak_factory_;
93
94 DISALLOW_COPY_AND_ASSIGN(MojoDemuxer);
95 };
96
97 } // namespace media
98
99 #endif // MEDIA_MOJO_CLIENTS_MOJO_DEMUXER_H_
OLDNEW
« no previous file with comments | « media/mojo/clients/mojo_data_source_impl.cc ('k') | media/mojo/clients/mojo_demuxer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698