OLD | NEW |
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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "media/mojo/interfaces/content_decryption_module.mojom.h" | 8 #include "media/mojo/interfaces/content_decryption_module.mojom.h" |
9 #include "media/mojo/interfaces/renderer.mojom.h" | 9 #include "media/mojo/interfaces/renderer.mojom.h" |
10 #include "mojo/public/cpp/bindings/interface_request.h" | 10 #include "mojo/public/cpp/bindings/interface_request.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 if (interface_name == media::mojom::ContentDecryptionModule::Name_) { | 30 if (interface_name == media::mojom::ContentDecryptionModule::Name_) { |
31 GetMediaServiceFactory()->CreateCdm( | 31 GetMediaServiceFactory()->CreateCdm( |
32 mojo::MakeRequest<media::mojom::ContentDecryptionModule>( | 32 mojo::MakeRequest<media::mojom::ContentDecryptionModule>( |
33 std::move(pipe))); | 33 std::move(pipe))); |
34 } else if (interface_name == media::mojom::Renderer::Name_) { | 34 } else if (interface_name == media::mojom::Renderer::Name_) { |
35 GetMediaServiceFactory()->CreateRenderer( | 35 GetMediaServiceFactory()->CreateRenderer( |
36 mojo::MakeRequest<media::mojom::Renderer>(std::move(pipe))); | 36 mojo::MakeRequest<media::mojom::Renderer>(std::move(pipe))); |
37 } else if (interface_name == media::mojom::AudioDecoder::Name_) { | 37 } else if (interface_name == media::mojom::AudioDecoder::Name_) { |
38 GetMediaServiceFactory()->CreateAudioDecoder( | 38 GetMediaServiceFactory()->CreateAudioDecoder( |
39 mojo::MakeRequest<media::mojom::AudioDecoder>(std::move(pipe))); | 39 mojo::MakeRequest<media::mojom::AudioDecoder>(std::move(pipe))); |
| 40 } else if (interface_name == media::mojom::VideoDecoder::Name_) { |
| 41 GetMediaServiceFactory()->CreateVideoDecoder( |
| 42 mojo::MakeRequest<media::mojom::VideoDecoder>(std::move(pipe))); |
40 } else { | 43 } else { |
41 NOTREACHED(); | 44 NOTREACHED(); |
42 } | 45 } |
43 } | 46 } |
44 | 47 |
45 media::mojom::ServiceFactory* MediaInterfaceProvider::GetMediaServiceFactory() { | 48 media::mojom::ServiceFactory* MediaInterfaceProvider::GetMediaServiceFactory() { |
46 DVLOG(1) << __FUNCTION__; | 49 DVLOG(1) << __FUNCTION__; |
47 DCHECK(thread_checker_.CalledOnValidThread()); | 50 DCHECK(thread_checker_.CalledOnValidThread()); |
48 | 51 |
49 if (!media_service_factory_) { | 52 if (!media_service_factory_) { |
50 shell::mojom::InterfaceProviderPtr interface_provider = | 53 shell::mojom::InterfaceProviderPtr interface_provider = |
51 connect_to_app_cb_.Run(GURL("mojo:media")); | 54 connect_to_app_cb_.Run(GURL("mojo:media")); |
52 shell::GetInterface(interface_provider.get(), &media_service_factory_); | 55 shell::GetInterface(interface_provider.get(), &media_service_factory_); |
53 media_service_factory_.set_connection_error_handler(base::Bind( | 56 media_service_factory_.set_connection_error_handler(base::Bind( |
54 &MediaInterfaceProvider::OnConnectionError, base::Unretained(this))); | 57 &MediaInterfaceProvider::OnConnectionError, base::Unretained(this))); |
55 } | 58 } |
56 | 59 |
57 return media_service_factory_.get(); | 60 return media_service_factory_.get(); |
58 } | 61 } |
59 | 62 |
60 void MediaInterfaceProvider::OnConnectionError() { | 63 void MediaInterfaceProvider::OnConnectionError() { |
61 DVLOG(1) << __FUNCTION__; | 64 DVLOG(1) << __FUNCTION__; |
62 DCHECK(thread_checker_.CalledOnValidThread()); | 65 DCHECK(thread_checker_.CalledOnValidThread()); |
63 | 66 |
64 media_service_factory_.reset(); | 67 media_service_factory_.reset(); |
65 } | 68 } |
66 | 69 |
67 } // namespace content | 70 } // namespace content |
OLD | NEW |