| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "media/base/fake_text_track_stream.h" | 5 #include "media/base/fake_text_track_stream.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "media/base/decoder_buffer.h" | 9 #include "media/base/decoder_buffer.h" |
| 10 #include "media/filters/webvtt_util.h" | 10 #include "media/filters/webvtt_util.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 if (stopping_) { | 29 if (stopping_) { |
| 30 task_runner_->PostTask(FROM_HERE, base::Bind( | 30 task_runner_->PostTask(FROM_HERE, base::Bind( |
| 31 &FakeTextTrackStream::AbortPendingRead, base::Unretained(this))); | 31 &FakeTextTrackStream::AbortPendingRead, base::Unretained(this))); |
| 32 } | 32 } |
| 33 } | 33 } |
| 34 | 34 |
| 35 DemuxerStream::Type FakeTextTrackStream::type() { | 35 DemuxerStream::Type FakeTextTrackStream::type() { |
| 36 return DemuxerStream::TEXT; | 36 return DemuxerStream::TEXT; |
| 37 } | 37 } |
| 38 | 38 |
| 39 bool FakeTextTrackStream::SupportsConfigChanges() { return false; } |
| 40 |
| 39 void FakeTextTrackStream::SatisfyPendingRead( | 41 void FakeTextTrackStream::SatisfyPendingRead( |
| 40 const base::TimeDelta& start, | 42 const base::TimeDelta& start, |
| 41 const base::TimeDelta& duration, | 43 const base::TimeDelta& duration, |
| 42 const std::string& id, | 44 const std::string& id, |
| 43 const std::string& content, | 45 const std::string& content, |
| 44 const std::string& settings) { | 46 const std::string& settings) { |
| 45 DCHECK(!read_cb_.is_null()); | 47 DCHECK(!read_cb_.is_null()); |
| 46 | 48 |
| 47 const uint8* const data_buf = reinterpret_cast<const uint8*>(content.data()); | 49 const uint8* const data_buf = reinterpret_cast<const uint8*>(content.data()); |
| 48 const int data_len = static_cast<int>(content.size()); | 50 const int data_len = static_cast<int>(content.size()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 74 base::ResetAndReturn(&read_cb_).Run(kOk, DecoderBuffer::CreateEOSBuffer()); | 76 base::ResetAndReturn(&read_cb_).Run(kOk, DecoderBuffer::CreateEOSBuffer()); |
| 75 } | 77 } |
| 76 | 78 |
| 77 void FakeTextTrackStream::Stop() { | 79 void FakeTextTrackStream::Stop() { |
| 78 stopping_ = true; | 80 stopping_ = true; |
| 79 if (!read_cb_.is_null()) | 81 if (!read_cb_.is_null()) |
| 80 AbortPendingRead(); | 82 AbortPendingRead(); |
| 81 } | 83 } |
| 82 | 84 |
| 83 } // namespace media | 85 } // namespace media |
| OLD | NEW |