Skip to content

Commit

Permalink
[media] Support progressive playback
Browse files Browse the repository at this point in the history
This PR brings the progressive demuxer from Cobalt C25 to support progressive videos.

b/322033277
  • Loading branch information
borongc committed Nov 14, 2024
1 parent 1740e9a commit 3f95cde
Show file tree
Hide file tree
Showing 27 changed files with 7,861 additions and 0 deletions.
1 change: 1 addition & 0 deletions media/base/decoder_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ class MEDIA_EXPORT DecoderBuffer
// If there's no data in this buffer, it represents end of stream.
#if BUILDFLAG(USE_STARBOARD_MEDIA)
bool end_of_stream() const { return !data_; }
void shrink_to(size_t size) { DCHECK_LE(size, size_); size_ = size; }
#else // BUILDFLAG(USE_STARBOARD_MEDIA)
bool end_of_stream() const {
return !read_only_mapping_.IsValid() && !writable_mapping_.IsValid() &&
Expand Down
5 changes: 5 additions & 0 deletions media/filters/demuxer_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ DemuxerManager::DemuxerManager(
enable_instant_source_buffer_gc_(enable_instant_source_buffer_gc),
demuxer_override_(std::move(demuxer_override)) {
DCHECK(client_);
LOG(ERROR) << "Cobalt " << __func__;
}

DemuxerManager::~DemuxerManager() {
Expand Down Expand Up @@ -372,6 +373,7 @@ PipelineStatus DemuxerManager::CreateDemuxer(
DataSource::Preload preload,
bool has_poster,
DemuxerManager::DemuxerCreatedCB on_demuxer_created) {
LOG(ERROR) << "Cobalt " << __func__;
// TODO(crbug/1377053) return a better error
if (!client_) {
return DEMUXER_ERROR_COULD_NOT_OPEN;
Expand Down Expand Up @@ -408,11 +410,14 @@ PipelineStatus DemuxerManager::CreateDemuxer(
SetDemuxer(std::move(demuxer_override_));
} else if (!load_media_source) {
#if BUILDFLAG(ENABLE_FFMPEG)
LOG(ERROR) << "Cobalt " << __func__;
SetDemuxer(CreateFFmpegDemuxer());
#else
LOG(ERROR) << "Cobalt " << __func__;
return DEMUXER_ERROR_COULD_NOT_OPEN;
#endif
} else {
LOG(ERROR) << "Cobalt " << __func__;
DCHECK(!HasDataSource());
SetDemuxer(CreateChunkDemuxer());
is_static = false;
Expand Down
1 change: 1 addition & 0 deletions media/filters/ffmpeg_demuxer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,7 @@ FFmpegDemuxer::FFmpegDemuxer(
DCHECK(task_runner_.get());
DCHECK(data_source_);
DCHECK(media_tracks_updated_cb_);
LOG(ERROR) << "Cobalt " << __func__;
}

FFmpegDemuxer::~FFmpegDemuxer() {
Expand Down
25 changes: 25 additions & 0 deletions media/starboard/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,24 @@ source_set("starboard") {
"decoder_buffer_allocator.cc",
"decoder_buffer_allocator.h",
"decoder_buffer_memory_info.h",
"progressive/avc_access_unit.cc",
"progressive/avc_access_unit.h",
"progressive/avc_parser.cc",
"progressive/avc_parser.h",
"progressive/data_source_reader.cc",
"progressive/data_source_reader.h",
"progressive/demuxer_extension_wrapper.cc",
"progressive/demuxer_extension_wrapper.h",
"progressive/mp4_map.cc",
"progressive/mp4_map.h",
"progressive/mp4_parser.cc",
"progressive/mp4_parser.h",
"progressive/progressive_demuxer.cc",
"progressive/progressive_demuxer.h",
"progressive/progressive_parser.cc",
"progressive/progressive_parser.h",
"progressive/rbsp_stream.cc",
"progressive/rbsp_stream.h",
"sbplayer_bridge.cc",
"sbplayer_bridge.h",
"sbplayer_interface.cc",
Expand All @@ -88,6 +106,10 @@ source_set("starboard") {
"//starboard/common",
]

if (use_starboard_media) {
deps += [ "//third_party/abseil-cpp:absl" ]
}

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

Expand All @@ -97,6 +119,9 @@ source_set("unit_tests") {
if (use_starboard_media) {
sources += [
"bidirectional_fit_reuse_allocator_test.cc",
"progressive/mock_data_source_reader.h",
"progressive/mp4_map_unittest.cc",
"progressive/rbsp_stream_unittest.cc",
"starboard_utils_test.cc",
]
}
Expand Down
Loading

0 comments on commit 3f95cde

Please sign in to comment.