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

Side by Side Diff: content/renderer/media/media_interface_provider.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
« no previous file with comments | « content/common/memory_messages.h ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "content/renderer/media/media_interface_provider.h" 5 #include "content/renderer/media/media_interface_provider.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "media/mojo/interfaces/content_decryption_module.mojom.h" 10 #include "media/mojo/interfaces/content_decryption_module.mojom.h"
11 #include "media/mojo/interfaces/demuxer.mojom.h"
11 #include "media/mojo/interfaces/renderer.mojom.h" 12 #include "media/mojo/interfaces/renderer.mojom.h"
12 #include "mojo/public/cpp/bindings/interface_request.h" 13 #include "mojo/public/cpp/bindings/interface_request.h"
13 #include "services/service_manager/public/cpp/interface_provider.h" 14 #include "services/service_manager/public/cpp/interface_provider.h"
14 15
15 namespace content { 16 namespace content {
16 17
17 MediaInterfaceProvider::MediaInterfaceProvider( 18 MediaInterfaceProvider::MediaInterfaceProvider(
18 service_manager::InterfaceProvider* remote_interfaces) 19 service_manager::InterfaceProvider* remote_interfaces)
19 : remote_interfaces_(remote_interfaces) {} 20 : remote_interfaces_(remote_interfaces) {}
20 21
(...skipping 13 matching lines...) Expand all
34 } else if (interface_name == media::mojom::Renderer::Name_) { 35 } else if (interface_name == media::mojom::Renderer::Name_) {
35 GetMediaInterfaceFactory()->CreateRenderer( 36 GetMediaInterfaceFactory()->CreateRenderer(
36 std::string(), 37 std::string(),
37 mojo::MakeRequest<media::mojom::Renderer>(std::move(pipe))); 38 mojo::MakeRequest<media::mojom::Renderer>(std::move(pipe)));
38 } else if (interface_name == media::mojom::AudioDecoder::Name_) { 39 } else if (interface_name == media::mojom::AudioDecoder::Name_) {
39 GetMediaInterfaceFactory()->CreateAudioDecoder( 40 GetMediaInterfaceFactory()->CreateAudioDecoder(
40 mojo::MakeRequest<media::mojom::AudioDecoder>(std::move(pipe))); 41 mojo::MakeRequest<media::mojom::AudioDecoder>(std::move(pipe)));
41 } else if (interface_name == media::mojom::VideoDecoder::Name_) { 42 } else if (interface_name == media::mojom::VideoDecoder::Name_) {
42 GetMediaInterfaceFactory()->CreateVideoDecoder( 43 GetMediaInterfaceFactory()->CreateVideoDecoder(
43 mojo::MakeRequest<media::mojom::VideoDecoder>(std::move(pipe))); 44 mojo::MakeRequest<media::mojom::VideoDecoder>(std::move(pipe)));
45 } else if (interface_name == media::mojom::Demuxer::Name_) {
46 GetMediaInterfaceFactory()->CreateDemuxer(
47 mojo::MakeRequest<media::mojom::Demuxer>(std::move(pipe)));
48 } else if (interface_name == media::mojom::SourceBuffer::Name_) {
49 GetMediaInterfaceFactory()->CreateSourceBuffer(
50 mojo::MakeRequest<media::mojom::SourceBuffer>(std::move(pipe)));
44 } else { 51 } else {
45 NOTREACHED(); 52 NOTREACHED();
46 } 53 }
47 } 54 }
48 55
49 media::mojom::InterfaceFactory* 56 media::mojom::InterfaceFactory*
50 MediaInterfaceProvider::GetMediaInterfaceFactory() { 57 MediaInterfaceProvider::GetMediaInterfaceFactory() {
51 DVLOG(1) << __func__; 58 DVLOG(1) << __func__;
52 DCHECK(thread_checker_.CalledOnValidThread()); 59 DCHECK(thread_checker_.CalledOnValidThread());
53 60
54 if (!media_interface_factory_) { 61 if (!media_interface_factory_) {
55 remote_interfaces_->GetInterface(&media_interface_factory_); 62 remote_interfaces_->GetInterface(&media_interface_factory_);
56 media_interface_factory_.set_connection_error_handler(base::Bind( 63 media_interface_factory_.set_connection_error_handler(base::Bind(
57 &MediaInterfaceProvider::OnConnectionError, base::Unretained(this))); 64 &MediaInterfaceProvider::OnConnectionError, base::Unretained(this)));
58 } 65 }
59 66
60 return media_interface_factory_.get(); 67 return media_interface_factory_.get();
61 } 68 }
62 69
63 void MediaInterfaceProvider::OnConnectionError() { 70 void MediaInterfaceProvider::OnConnectionError() {
64 DVLOG(1) << __func__; 71 DVLOG(1) << __func__;
65 DCHECK(thread_checker_.CalledOnValidThread()); 72 DCHECK(thread_checker_.CalledOnValidThread());
66 73
67 media_interface_factory_.reset(); 74 media_interface_factory_.reset();
68 } 75 }
69 76
70 } // namespace content 77 } // namespace content
OLDNEW
« no previous file with comments | « content/common/memory_messages.h ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698