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

Side by Side Diff: media/mojo/services/mojo_demuxer_service_context.cc

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
OLDNEW
(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 #include "media/mojo/services/mojo_demuxer_service_context.h"
6
7 #include "media/base/demuxer.h"
8 #include "media/mojo/services/mojo_demuxer_service.h"
9
10 namespace media {
11
12 MojoDemuxerServiceContext::MojoDemuxerServiceContext()
13 : weak_ptr_factory_(this) {}
14
15 MojoDemuxerServiceContext::~MojoDemuxerServiceContext() {}
16
17 base::WeakPtr<MojoDemuxerServiceContext>
18 MojoDemuxerServiceContext::GetWeakPtr() {
19 return weak_ptr_factory_.GetWeakPtr();
20 }
21
22 void MojoDemuxerServiceContext::RegisterDemuxer(
23 int demuxer_id,
24 MojoDemuxerService* demuxer_service) {
25 DCHECK(!demuxer_services_.count(demuxer_id));
26 DCHECK(demuxer_service);
27 demuxer_services_[demuxer_id] = demuxer_service;
28 }
29
30 void MojoDemuxerServiceContext::UnregisterDemuxer(int demuxer_id) {
31 DCHECK(demuxer_services_.count(demuxer_id));
32 demuxer_services_.erase(demuxer_id);
33 }
34
35 Demuxer* MojoDemuxerServiceContext::GetDemuxer(
36 int demuxer_id,
37 const PipelineStatusCB& demuxer_init_cb) {
38 auto demuxer_service = demuxer_services_.find(demuxer_id);
39 if (demuxer_service == demuxer_services_.end()) {
40 LOG(ERROR) << "Demuxer service not found: " << demuxer_id;
41 return nullptr;
42 }
43
44 return demuxer_service->second->GetDemuxer(demuxer_init_cb);
45 }
46
47 media::Demuxer* MojoDemuxerServiceContext::GetDemuxerSourceBuffer(
48 int demuxer_id,
49 media::SourceBuffer** source_buffer_out) {
50 auto demuxer_service = demuxer_services_.find(demuxer_id);
51 if (demuxer_service == demuxer_services_.end()) {
52 LOG(ERROR) << "Demuxer service not found: " << demuxer_id;
53 return nullptr;
54 }
55
56 return demuxer_service->second->GetDemuxerSourceBuffer(source_buffer_out);
57 }
58
59 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/services/mojo_demuxer_service_context.h ('k') | media/mojo/services/mojo_media_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698