Skip to content

Commit

Permalink
[Chromecast] Move chromecast/browser/media into chromecast/media subdirs
Browse files Browse the repository at this point in the history
The files in chromecast/browser/media no longer have anything to do with
the browser process. Dissolve this directory into several subdirs in
chromecast/media.

 * Files that implement Mojo services have been moved to
   chromecast/media/service/.
 * CastBrowserCdmFactory has been renamed CastCdmFactory and moved to
   chromecast/media/cdm/.
 * VideoResolutionPolicy has been moved to chromecast/media/base.

 No other changes have been made.

BUG=

Review-Url: https://codereview.chromium.org/2451873005
Cr-Commit-Position: refs/heads/master@{#428509}
  • Loading branch information
slan authored and Commit bot committed Oct 28, 2016
1 parent f4e61e9 commit c142db1
Show file tree
Hide file tree
Showing 19 changed files with 87 additions and 98 deletions.
2 changes: 1 addition & 1 deletion chromecast/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ source_set("cast_shell_common") {

source_set("cast_shell_media") {
deps = [
"//chromecast/browser/media",
"//chromecast/common/media",
"//chromecast/media/service",
"//chromecast/renderer/media",
]
}
Expand Down
8 changes: 4 additions & 4 deletions chromecast/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ source_set("browser") {
"devtools/remote_debugging_server.h",
"geolocation/cast_access_token_store.cc",
"geolocation/cast_access_token_store.h",
"media/media_caps_impl.cc",
"media/media_caps_impl.h",
"metrics/cast_metrics_prefs.cc",
"metrics/cast_metrics_prefs.h",
"metrics/cast_metrics_service_client.cc",
Expand All @@ -71,10 +73,6 @@ source_set("browser") {
]
}

public_deps = [
"//chromecast/browser/media",
]

deps = [
"//base",
"//base:i18n",
Expand All @@ -89,8 +87,10 @@ source_set("browser") {
"//chromecast/browser:resources",
"//chromecast/common",
"//chromecast/common/media",
"//chromecast/common/media:interfaces",
"//chromecast/graphics",
"//chromecast/media",
"//chromecast/media/service",
"//chromecast/net",
"//chromecast/service",
"//components/crash/content/app",
Expand Down
8 changes: 4 additions & 4 deletions chromecast/browser/cast_content_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@
#include "ui/gl/gl_switches.h"

#if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS)
#include "chromecast/browser/media/cast_mojo_media_client.h"
#include "chromecast/media/service/cast_mojo_media_client.h"
#include "media/mojo/services/media_service.h" // nogncheck
#endif // ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS

#if defined(OS_ANDROID)
#include "components/crash/content/browser/crash_dump_manager_android.h"
#else
#include "chromecast/browser/media/cast_browser_cdm_factory.h"
#include "chromecast/media/cdm/cast_cdm_factory.h"
#endif // defined(OS_ANDROID)

namespace chromecast {
Expand Down Expand Up @@ -484,8 +484,8 @@ ::media::ScopedAudioManagerPtr CastContentBrowserClient::CreateAudioManager(
std::unique_ptr<::media::CdmFactory>
CastContentBrowserClient::CreateCdmFactory() {
#if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS)
return base::MakeUnique<media::CastBrowserCdmFactory>(
GetMediaTaskRunner(), media_resource_tracker());
return base::MakeUnique<media::CastCdmFactory>(GetMediaTaskRunner(),
media_resource_tracker());
#endif // defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS)
return nullptr;
}
Expand Down
50 changes: 0 additions & 50 deletions chromecast/browser/media/BUILD.gn

This file was deleted.

7 changes: 3 additions & 4 deletions chromecast/browser/media/media_caps_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ void MediaCapsImpl::SetSupportedHdmiSinkCodecs(
void MediaCapsImpl::ScreenResolutionChanged(unsigned width, unsigned height) {
screen_resolution_ = gfx::Size(width, height);

observers_.ForAllPtrs(
[width, height](mojom::MediaCapsObserver* observer) {
observer->ScreenResolutionChanged(width, height);
});
observers_.ForAllPtrs([width, height](mojom::MediaCapsObserver* observer) {
observer->ScreenResolutionChanged(width, height);
});
}

void MediaCapsImpl::ScreenInfoChanged(int hdcp_version,
Expand Down
1 change: 0 additions & 1 deletion chromecast/common/media/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ include_rules = [
"+chromecast/media",
"+components/cdm/common",
"+media/base",
"+mojo/public",
]
7 changes: 7 additions & 0 deletions chromecast/media/base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ source_set("base") {
"video_plane_controller.h",
]

if (!is_android) {
sources += [
"video_resolution_policy.cc",
"video_resolution_policy.h",
]
}

public_deps = [
":key_systems",
"//chromecast/public/media",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chromecast/browser/media/video_resolution_policy.h"
#include "chromecast/media/base/video_resolution_policy.h"

namespace chromecast {
namespace media {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROMECAST_BROWSER_MEDIA_VIDEO_RESOLUTION_POLICY_H_
#define CHROMECAST_BROWSER_MEDIA_VIDEO_RESOLUTION_POLICY_H_
#ifndef CHROMECAST_MEDIA_BASE_VIDEO_RESOLUTION_POLICY_H_
#define CHROMECAST_MEDIA_BASE_VIDEO_RESOLUTION_POLICY_H_

#include "base/macros.h"

Expand Down Expand Up @@ -41,4 +41,4 @@ class VideoResolutionPolicy {
} // namespace media
} // namespace chromecast

#endif // CHROMECAST_BROWSER_MEDIA_VIDEO_RESOLUTION_POLICY_H_
#endif // CHROMECAST_MEDIA_BASE_VIDEO_RESOLUTION_POLICY_H_
2 changes: 2 additions & 0 deletions chromecast/media/cdm/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ source_set("cdm") {
"cast_cdm.h",
"cast_cdm_context.cc",
"cast_cdm_context.h",
"cast_cdm_factory.cc",
"cast_cdm_factory.h",
"cast_cdm_proxy.cc",
"cast_cdm_proxy.h",
"chromecast_init_data.cc",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chromecast/browser/media/cast_browser_cdm_factory.h"
#include "chromecast/media/cdm/cast_cdm_factory.h"

#include "base/bind.h"
#include "base/location.h"
Expand All @@ -19,7 +19,7 @@
namespace chromecast {
namespace media {

CastBrowserCdmFactory::CastBrowserCdmFactory(
CastCdmFactory::CastCdmFactory(
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
MediaResourceTracker* media_resource_tracker)
: media_resource_tracker_(media_resource_tracker),
Expand All @@ -28,9 +28,9 @@ CastBrowserCdmFactory::CastBrowserCdmFactory(
DCHECK(task_runner_);
}

CastBrowserCdmFactory::~CastBrowserCdmFactory() {}
CastCdmFactory::~CastCdmFactory() {}

void CastBrowserCdmFactory::Create(
void CastCdmFactory::Create(
const std::string& key_system,
const GURL& security_origin,
const ::media::CdmConfig& cdm_config,
Expand Down Expand Up @@ -78,7 +78,7 @@ void CastBrowserCdmFactory::Create(
#endif // defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS)
}

scoped_refptr<CastCdm> CastBrowserCdmFactory::CreatePlatformBrowserCdm(
scoped_refptr<CastCdm> CastCdmFactory::CreatePlatformBrowserCdm(
const CastKeySystem& cast_key_system,
const GURL& security_origin) {
return nullptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROMECAST_BROWSER_MEDIA_CAST_BROWSER_CDM_FACTORY_H_
#define CHROMECAST_BROWSER_MEDIA_CAST_BROWSER_CDM_FACTORY_H_
#ifndef CHROMECAST_MEDIA_CDM_CAST_CDM_FACTORY_H_
#define CHROMECAST_MEDIA_CDM_CAST_CDM_FACTORY_H_

#include "base/macros.h"
#include "chromecast/media/base/key_systems_common.h"
Expand All @@ -20,12 +20,12 @@ namespace media {

class CastCdm;

class CastBrowserCdmFactory : public ::media::CdmFactory {
class CastCdmFactory : public ::media::CdmFactory {
public:
// CDM factory will use |task_runner| to initialize the CDM.
CastBrowserCdmFactory(scoped_refptr<base::SingleThreadTaskRunner> task_runner,
MediaResourceTracker* media_resource_tracker);
~CastBrowserCdmFactory() override;
CastCdmFactory(scoped_refptr<base::SingleThreadTaskRunner> task_runner,
MediaResourceTracker* media_resource_tracker);
~CastCdmFactory() override;

// ::media::CdmFactory implementation:
void Create(
Expand All @@ -48,10 +48,10 @@ class CastBrowserCdmFactory : public ::media::CdmFactory {

private:
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
DISALLOW_COPY_AND_ASSIGN(CastBrowserCdmFactory);
DISALLOW_COPY_AND_ASSIGN(CastCdmFactory);
};

} // namespace media
} // namespace chromecast

#endif // CHROMECAST_BROWSER_MEDIA_CAST_BROWSER_CDM_FACTORY_H_
#endif // CHROMECAST_MEDIA_CDM_CAST_CDM_FACTORY_H_
27 changes: 27 additions & 0 deletions chromecast/media/service/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

source_set("service") {
sources = [
"cast_mojo_media_client.cc",
"cast_mojo_media_client.h",
"cast_renderer.cc",
"cast_renderer.h",
"media_pipeline_backend_factory.h",
]

public_deps = [
"//media/mojo/interfaces",
"//media/mojo/services",
"//services/service_manager/public/cpp",
]

deps = [
"//base",
"//chromecast/base",
"//chromecast/media",
"//media",
"//ui/gfx/geometry",
]
}
4 changes: 4 additions & 0 deletions chromecast/media/service/DEPS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include_rules = [
"+media/mojo",
"+mojo/public/cpp",
]
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chromecast/browser/media/cast_mojo_media_client.h"
#include "chromecast/media/service/cast_mojo_media_client.h"

#include "base/memory/ptr_util.h"
#include "chromecast/browser/media/cast_renderer.h"
#include "chromecast/media/service/cast_renderer.h"
#include "media/base/audio_renderer_sink.h"
#include "media/base/cdm_factory.h"
#include "media/base/media_log.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROMECAST_BROWSER_MEDIA_CAST_MOJO_MEDIA_CLIENT_H_
#define CHROMECAST_BROWSER_MEDIA_CAST_MOJO_MEDIA_CLIENT_H_
#ifndef CHROMECAST_MEDIA_SERVICE_CAST_MOJO_MEDIA_CLIENT_H_
#define CHROMECAST_MEDIA_SERVICE_CAST_MOJO_MEDIA_CLIENT_H_

#include "chromecast/browser/media/media_pipeline_backend_factory.h"
#include "chromecast/media/service/media_pipeline_backend_factory.h"
#include "media/mojo/services/mojo_media_client.h"

namespace chromecast {
Expand Down Expand Up @@ -45,4 +45,4 @@ class CastMojoMediaClient : public ::media::MojoMediaClient {
} // namespace media
} // namespace chromecast

#endif // CHROMECAST_BROWSER_MEDIA_CAST_MOJO_MEDIA_CLIENT_H_
#endif // CHROMECAST_MEDIA_SERVICE_CAST_MOJO_MEDIA_CLIENT_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chromecast/browser/media/cast_renderer.h"
#include "chromecast/media/service/cast_renderer.h"

#include "base/bind.h"
#include "base/single_thread_task_runner.h"
#include "chromecast/base/task_runner_impl.h"
#include "chromecast/browser/media/video_resolution_policy.h"
#include "chromecast/media/base/video_resolution_policy.h"
#include "chromecast/media/cdm/cast_cdm_context.h"
#include "chromecast/media/cma/base/balanced_media_task_runner_factory.h"
#include "chromecast/media/cma/base/cma_logging.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROMECAST_BROWSER_MEDIA_CAST_RENDERER_H_
#define CHROMECAST_BROWSER_MEDIA_CAST_RENDERER_H_
#ifndef CHROMECAST_MEDIA_SERVICE_CAST_RENDERER_H_
#define CHROMECAST_MEDIA_SERVICE_CAST_RENDERER_H_

#include "base/memory/weak_ptr.h"
#include "chromecast/browser/media/media_pipeline_backend_factory.h"
#include "chromecast/browser/media/video_resolution_policy.h"
#include "chromecast/media/base/media_resource_tracker.h"
#include "chromecast/media/base/video_resolution_policy.h"
#include "chromecast/media/service/media_pipeline_backend_factory.h"
#include "media/base/renderer.h"
#include "ui/gfx/geometry/size.h"

Expand Down Expand Up @@ -89,4 +89,4 @@ class CastRenderer : public ::media::Renderer,
} // namespace media
} // namespace chromecast

#endif // CHROMECAST_BROWSER_MEDIA_CAST_RENDERER_H_
#endif // CHROMECAST_MEDIA_SERVICE_CAST_RENDERER_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROMECAST_BROWSER_MEDIA_MEDIA_PIPELINE_BACKEND_FACTORY_H_
#define CHROMECAST_BROWSER_MEDIA_MEDIA_PIPELINE_BACKEND_FACTORY_H_
#ifndef CHROMECAST_MEDIA_SERVICE_MEDIA_PIPELINE_BACKEND_FACTORY_H_
#define CHROMECAST_MEDIA_SERVICE_MEDIA_PIPELINE_BACKEND_FACTORY_H_

#include <memory>
#include <string>
Expand All @@ -17,9 +17,10 @@ namespace media {

typedef base::Callback<std::unique_ptr<MediaPipelineBackend>(
const MediaPipelineDeviceParams&,
const std::string& audio_device_id)> CreateMediaPipelineBackendCB;
const std::string& audio_device_id)>
CreateMediaPipelineBackendCB;

} // media
} // chromecast

#endif // CHROMECAST_BROWSER_MEDIA_MEDIA_PIPELINE_BACKEND_FACTORY_H_
#endif // CHROMECAST_MEDIA_SERVICE_MEDIA_PIPELINE_BACKEND_FACTORY_H_

0 comments on commit c142db1

Please sign in to comment.