Commit 921029a5 authored by wolenetz@chromium.org's avatar wolenetz@chromium.org

MSE: Remove Chromium-side support for LegacyFrameProcessor

This is the second of a three-sided change to remove
LegacyFrameProcessor from Blink and Chromium now that the new
FrameProcessor is stabilized.

R=acolwell@chromium.org
BUG=249422
TEST=No media_unittest or MSE layout test regression locally on Linux

Review URL: https://codereview.chromium.org/315483002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278255 0039d316-1c4b-4281-b951-d872f2087c98
parent 34cd671e
......@@ -36,19 +36,15 @@ WebMediaSourceImpl::~WebMediaSourceImpl() {}
WebMediaSource::AddStatus WebMediaSourceImpl::addSourceBuffer(
const blink::WebString& type,
const blink::WebVector<blink::WebString>& codecs,
const WebMediaSource::FrameProcessorChoice frame_processor_choice,
blink::WebSourceBuffer** source_buffer) {
std::string id = base::GenerateGUID();
std::vector<std::string> new_codecs(codecs.size());
for (size_t i = 0; i < codecs.size(); ++i)
new_codecs[i] = codecs[i].utf8().data();
// Ignore |frame_processor_choice|. Instead, request the new FrameProcessor.
// TODO(wolenetz): Remove |frame_processor_choice| and LegacyFrameProcessor
// once the new FrameProcessor has stabilized. See http://crbug.com/249422.
WebMediaSource::AddStatus result =
static_cast<WebMediaSource::AddStatus>(
demuxer_->AddId(id, type.utf8().data(), new_codecs, false));
demuxer_->AddId(id, type.utf8().data(), new_codecs));
if (result == WebMediaSource::AddStatusOk)
*source_buffer = new WebSourceBufferImpl(id, demuxer_);
......
......@@ -26,7 +26,6 @@ class WebMediaSourceImpl : public blink::WebMediaSource {
virtual AddStatus addSourceBuffer(
const blink::WebString& type,
const blink::WebVector<blink::WebString>& codecs,
const FrameProcessorChoice frame_processor_choice,
blink::WebSourceBuffer** source_buffer);
virtual double duration();
virtual void setDuration(double duration);
......
......@@ -18,7 +18,6 @@
#include "media/base/stream_parser_buffer.h"
#include "media/base/video_decoder_config.h"
#include "media/filters/frame_processor.h"
#include "media/filters/legacy_frame_processor.h"
#include "media/filters/stream_parser_factory.h"
using base::TimeDelta;
......@@ -96,7 +95,7 @@ class SourceState {
SourceState(
scoped_ptr<StreamParser> stream_parser,
scoped_ptr<FrameProcessorBase> frame_processor, const LogCB& log_cb,
scoped_ptr<FrameProcessor> frame_processor, const LogCB& log_cb,
const CreateDemuxerStreamCB& create_demuxer_stream_cb);
~SourceState();
......@@ -228,7 +227,7 @@ class SourceState {
typedef std::map<StreamParser::TrackId, ChunkDemuxerStream*> TextStreamMap;
TextStreamMap text_stream_map_; // |this| owns the map's stream pointers.
scoped_ptr<FrameProcessorBase> frame_processor_;
scoped_ptr<FrameProcessor> frame_processor_;
LogCB log_cb_;
StreamParser::InitCB init_cb_;
......@@ -242,7 +241,7 @@ class SourceState {
};
SourceState::SourceState(scoped_ptr<StreamParser> stream_parser,
scoped_ptr<FrameProcessorBase> frame_processor,
scoped_ptr<FrameProcessor> frame_processor,
const LogCB& log_cb,
const CreateDemuxerStreamCB& create_demuxer_stream_cb)
: create_demuxer_stream_cb_(create_demuxer_stream_cb),
......@@ -1147,11 +1146,9 @@ void ChunkDemuxer::CancelPendingSeek(TimeDelta seek_time) {
base::ResetAndReturn(&seek_cb_).Run(PIPELINE_OK);
}
ChunkDemuxer::Status ChunkDemuxer::AddId(
const std::string& id,
const std::string& type,
std::vector<std::string>& codecs,
const bool use_legacy_frame_processor) {
ChunkDemuxer::Status ChunkDemuxer::AddId(const std::string& id,
const std::string& type,
std::vector<std::string>& codecs) {
base::AutoLock auto_lock(lock_);
if ((state_ != WAITING_FOR_INIT && state_ != INITIALIZING) || IsValidId(id))
......@@ -1176,16 +1173,9 @@ ChunkDemuxer::Status ChunkDemuxer::AddId(
if (has_video)
source_id_video_ = id;
scoped_ptr<FrameProcessorBase> frame_processor;
if (use_legacy_frame_processor) {
frame_processor.reset(new LegacyFrameProcessor(
base::Bind(&ChunkDemuxer::IncreaseDurationIfNecessary,
base::Unretained(this))));
} else {
frame_processor.reset(new FrameProcessor(
base::Bind(&ChunkDemuxer::IncreaseDurationIfNecessary,
base::Unretained(this))));
}
scoped_ptr<FrameProcessor> frame_processor(
new FrameProcessor(base::Bind(&ChunkDemuxer::IncreaseDurationIfNecessary,
base::Unretained(this))));
scoped_ptr<SourceState> source_state(
new SourceState(stream_parser.Pass(),
......
......@@ -191,16 +191,13 @@ class MEDIA_EXPORT ChunkDemuxer : public Demuxer {
// Registers a new |id| to use for AppendData() calls. |type| indicates
// the MIME type for the data that we intend to append for this ID.
// |use_legacy_frame_processor| determines which of LegacyFrameProcessor or
// FrameProcessor to use to process parsed frames from AppendData() calls.
// kOk is returned if the demuxer has enough resources to support another ID
// and supports the format indicated by |type|.
// kNotSupported is returned if |type| is not a supported format.
// kReachedIdLimit is returned if the demuxer cannot handle another ID right
// now.
Status AddId(const std::string& id, const std::string& type,
std::vector<std::string>& codecs,
const bool use_legacy_frame_processor);
std::vector<std::string>& codecs);
// Removed an ID & associated resources that were previously added with
// AddId().
......
This diff is collapsed.
This diff is collapsed.
// Copyright 2014 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.
#ifndef MEDIA_FILTERS_LEGACY_FRAME_PROCESSOR_H_
#define MEDIA_FILTERS_LEGACY_FRAME_PROCESSOR_H_
#include "base/basictypes.h"
#include "base/time/time.h"
#include "media/base/media_export.h"
#include "media/base/stream_parser.h"
#include "media/filters/frame_processor_base.h"
namespace media {
// Helper class that implements Media Source Extension's coded frame processing
// algorithm.
class MEDIA_EXPORT LegacyFrameProcessor : public FrameProcessorBase {
public:
// Callback signature used to notify ChunkDemuxer of an end timestamp that may
// cause the duration to be updated.
typedef base::Callback<void(base::TimeDelta)> IncreaseDurationCB;
explicit LegacyFrameProcessor(const IncreaseDurationCB& increase_duration_cb);
virtual ~LegacyFrameProcessor();
// FrameProcessorBase implementation
virtual void SetSequenceMode(bool sequence_mode) OVERRIDE;
virtual bool ProcessFrames(const StreamParser::BufferQueue& audio_buffers,
const StreamParser::BufferQueue& video_buffers,
const StreamParser::TextBufferQueueMap& text_map,
base::TimeDelta append_window_start,
base::TimeDelta append_window_end,
bool* new_media_segment,
base::TimeDelta* timestamp_offset) OVERRIDE;
private:
// Helper function that adds |timestamp_offset| to each buffer in |buffers|.
void AdjustBufferTimestamps(const StreamParser::BufferQueue& buffers,
base::TimeDelta timestamp_offset);
// Filters out buffers that are outside of the append window
// [|append_window_start|, |append_window_end|). |track|'s
// "needs random access point" is read and updated as this method filters
// |buffers|. Buffers that are inside the append window are appended to the
// end of |filtered_buffers|. |track| must be the track associated with all
// items in |buffers|. |*new_media_segment| is set true if any of |buffers|
// are filtered out.
void FilterWithAppendWindow(base::TimeDelta append_window_start,
base::TimeDelta append_window_end,
const StreamParser::BufferQueue& buffers,
MseTrackBuffer* track,
bool* new_media_segment,
StreamParser::BufferQueue* filtered_buffers);
// Helper function that appends |buffers| to |stream| and calls
// |increase_duration_cb_| to potentially update the duration.
// Returns true if the append was successful. Returns false if
// |stream| is NULL or something in |buffers| caused the append to fail.
bool AppendAndUpdateDuration(ChunkDemuxerStream* stream,
const StreamParser::BufferQueue& buffers);
// Helper function for Legacy ProcessFrames() when new text buffers have been
// parsed.
// Applies |timestamp_offset| to all buffers in |buffers|, filters |buffers|
// with append window, and stores those filtered buffers into |filtered_text|
// based on |text_track_id|. If any of |buffers| are filtered out by append
// window, then |*new_media_segment| is set true.
// Updates |lowest_segment_timestamp| to be the earliest decode timestamp of
// all buffers in |filtered_text|.
// Returns true on a successful call. Returns false if an error occurred while
// processing the buffers.
bool FilterTextBuffers(StreamParser::TrackId text_track_id,
base::TimeDelta append_window_start,
base::TimeDelta append_window_end,
base::TimeDelta timestamp_offset,
const StreamParser::BufferQueue& buffers,
bool* new_media_segment,
base::TimeDelta* lowest_segment_timestamp,
StreamParser::TextBufferQueueMap* filtered_text);
IncreaseDurationCB increase_duration_cb_;
DISALLOW_COPY_AND_ASSIGN(LegacyFrameProcessor);
};
} // namespace media
#endif // MEDIA_FILTERS_LEGACY_FRAME_PROCESSOR_H_
This diff is collapsed.
......@@ -412,8 +412,6 @@
'filters/h264_parser.h',
'filters/in_memory_url_protocol.cc',
'filters/in_memory_url_protocol.h',
'filters/legacy_frame_processor.cc',
'filters/legacy_frame_processor.h',
'filters/opus_audio_decoder.cc',
'filters/opus_audio_decoder.h',
'filters/skcanvas_video_renderer.cc',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment