Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move starboard media headers to prevent circular dependency #4593

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions media/base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,15 @@ source_set("base") {
"webvtt_util.h",
]

if (use_starboard_media) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may not be the best way to resolve this circular dependency. The original dependency from //media/base to //media/starboard was introduced in https://github.com/youtube/cobalt/pull/4348/files#diff-ec1e4ec37e5873a7e4de1c82ef9858dd14c5e4c82d786879d8aa65b3e909df98R67. The code adds decoder_buffer_allocator_ to MediaClient, which is supposed to be mostly an interface.

The concrete implementation (i.e. decoder_buffer_allocator_) should be added to a derived class of MediaClient, e.g. RenderMediaClient. In that case the circular dependency will be removed, and Starboard code can stay in //media/starboard.

sources += [
"starboard/bidirectional_fit_reuse_allocator.h",
"starboard/decoder_buffer_allocator.h",
"starboard/decoder_buffer_memory_info.h",
"starboard/starboard_memory_allocator.h",
]
}

defines = []
public_deps = [
":video_facing",
Expand Down
2 changes: 1 addition & 1 deletion media/base/media_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "url/gurl.h"

#if BUILDFLAG(USE_STARBOARD_MEDIA)
#include "media/starboard/decoder_buffer_allocator.h"
#include "media/base/starboard/decoder_buffer_allocator.h"
#endif // BUILDFLAG(USE_STARBOARD_MEDIA)

namespace media {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef MEDIA_STARBOARD_BIDIRECTIONAL_FIT_REUSE_ALLOCATOR_H_
#define MEDIA_STARBOARD_BIDIRECTIONAL_FIT_REUSE_ALLOCATOR_H_
#ifndef MEDIA_BASE_STARBOARD_BIDIRECTIONAL_FIT_REUSE_ALLOCATOR_H_
#define MEDIA_BASE_STARBOARD_BIDIRECTIONAL_FIT_REUSE_ALLOCATOR_H_

#include "starboard/common/reuse_allocator_base.h"
#include "starboard/configuration.h"
Expand Down Expand Up @@ -50,4 +50,4 @@ class BidirectionalFitReuseAllocator

} // namespace media

#endif // MEDIA_STARBOARD_BIDIRECTIONAL_FIT_REUSE_ALLOCATOR_H_
#endif // MEDIA_BASE_STARBOARD_BIDIRECTIONAL_FIT_REUSE_ALLOCATOR_H_
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef MEDIA_STARBOARD_DECODER_BUFFER_ALLOCATOR_H_
#define MEDIA_STARBOARD_DECODER_BUFFER_ALLOCATOR_H_
#ifndef MEDIA_BASE_STARBOARD_DECODER_BUFFER_ALLOCATOR_H_
#define MEDIA_BASE_STARBOARD_DECODER_BUFFER_ALLOCATOR_H_

#include <atomic>
#include <memory>
Expand All @@ -23,9 +23,9 @@
#include "base/time/time.h"
#include "media/base/decoder_buffer.h"
#include "media/base/video_decoder_config.h"
#include "media/starboard/bidirectional_fit_reuse_allocator.h"
#include "media/starboard/decoder_buffer_memory_info.h"
#include "media/starboard/starboard_memory_allocator.h"
#include "media/base/starboard/bidirectional_fit_reuse_allocator.h"
#include "media/base/starboard/decoder_buffer_memory_info.h"
#include "media/base/starboard/starboard_memory_allocator.h"
#include "starboard/media.h"

namespace media {
Expand Down Expand Up @@ -77,4 +77,4 @@ class DecoderBufferAllocator : public DecoderBuffer::Allocator,

} // namespace media

#endif // MEDIA_STARBOARD_DECODER_BUFFER_ALLOCATOR_H_
#endif // MEDIA_BASE_STARBOARD_DECODER_BUFFER_ALLOCATOR_H_
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef MEDIA_STARBOARD_DECODER_BUFFER_MEMORY_INFO_H_
#define MEDIA_STARBOARD_DECODER_BUFFER_MEMORY_INFO_H_
#ifndef MEDIA_BASE_STARBOARD_DECODER_BUFFER_MEMORY_INFO_H_
#define MEDIA_BASE_STARBOARD_DECODER_BUFFER_MEMORY_INFO_H_

#include "starboard/media.h"
#include "starboard/types.h"
Expand All @@ -40,4 +40,4 @@ class StubDecoderBufferMemoryInfo : public DecoderBufferMemoryInfo {

} // namespace media

#endif // MEDIA_STARBOARD_DECODER_BUFFER_MEMORY_INFO_H_
#endif // MEDIA_BASE_STARBOARD_DECODER_BUFFER_MEMORY_INFO_H_
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef MEDIA_STARBOARD_STARBOARD_MEMORY_ALLOCATOR_H_
#define MEDIA_STARBOARD_STARBOARD_MEMORY_ALLOCATOR_H_
#ifndef MEDIA_BASE_STARBOARD_STARBOARD_MEMORY_ALLOCATOR_H_
#define MEDIA_BASE_STARBOARD_STARBOARD_MEMORY_ALLOCATOR_H_

#include <stdlib.h>

Expand Down Expand Up @@ -54,4 +54,4 @@ class StarboardMemoryAllocator : public starboard::common::Allocator {

} // namespace media

#endif // MEDIA_STARBOARD_STARBOARD_MEMORY_ALLOCATOR_H_
#endif // MEDIA_BASE_STARBOARD_STARBOARD_MEMORY_ALLOCATOR_H_
7 changes: 0 additions & 7 deletions media/starboard/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,7 @@ source_set("starboard") {
if (use_starboard_media) {
sources += [
"bidirectional_fit_reuse_allocator.cc",
"bidirectional_fit_reuse_allocator.h",
"decoder_buffer_allocator.cc",
"decoder_buffer_allocator.h",
"decoder_buffer_memory_info.h",
"sbplayer_bridge.cc",
"sbplayer_bridge.h",
"sbplayer_interface.cc",
Expand All @@ -93,7 +90,6 @@ source_set("starboard") {
"starboard_cdm.h",
"starboard_cdm_factory.cc",
"starboard_cdm_factory.h",
"starboard_memory_allocator.h",
"starboard_renderer.cc",
"starboard_renderer.h",
"starboard_renderer_factory.cc",
Expand All @@ -117,9 +113,6 @@ source_set("starboard") {
deps += [ "//third_party/abseil-cpp:absl" ]
}

# TODO(b/380940036): remove the circular dependency.
allow_circular_includes_from = [ "//media/base" ]

configs += [ "//media:subcomponent_config" ]
}

Expand Down
2 changes: 1 addition & 1 deletion media/starboard/bidirectional_fit_reuse_allocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "media/starboard/bidirectional_fit_reuse_allocator.h"
#include "media/base/starboard/bidirectional_fit_reuse_allocator.h"

#include <algorithm>

Expand Down
2 changes: 1 addition & 1 deletion media/starboard/decoder_buffer_allocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "media/starboard/decoder_buffer_allocator.h"
#include "media/base/starboard/decoder_buffer_allocator.h"

#include <algorithm>
#include <vector>
Expand Down
Loading