| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 const uint8* const sd_buf = &side_data[0]; | 61 const uint8* const sd_buf = &side_data[0]; |
| 62 const int sd_len = static_cast<int>(side_data.size()); | 62 const int sd_len = static_cast<int>(side_data.size()); |
| 63 | 63 |
| 64 scoped_refptr<DecoderBuffer> buffer; | 64 scoped_refptr<DecoderBuffer> buffer; |
| 65 buffer = DecoderBuffer::CopyFrom(data_buf, data_len, sd_buf, sd_len); | 65 buffer = DecoderBuffer::CopyFrom(data_buf, data_len, sd_buf, sd_len); |
| 66 | 66 |
| 67 buffer->set_timestamp(start); | 67 buffer->set_timestamp(start); |
| 68 buffer->set_duration(duration); | 68 buffer->set_duration(duration); |
| 69 | 69 |
| 70 // Assume all fake text buffers are keyframes. |
| 71 buffer->set_is_key_frame(true); |
| 72 |
| 70 base::ResetAndReturn(&read_cb_).Run(kOk, buffer); | 73 base::ResetAndReturn(&read_cb_).Run(kOk, buffer); |
| 71 } | 74 } |
| 72 | 75 |
| 73 void FakeTextTrackStream::AbortPendingRead() { | 76 void FakeTextTrackStream::AbortPendingRead() { |
| 74 DCHECK(!read_cb_.is_null()); | 77 DCHECK(!read_cb_.is_null()); |
| 75 base::ResetAndReturn(&read_cb_).Run(kAborted, NULL); | 78 base::ResetAndReturn(&read_cb_).Run(kAborted, NULL); |
| 76 } | 79 } |
| 77 | 80 |
| 78 void FakeTextTrackStream::SendEosNotification() { | 81 void FakeTextTrackStream::SendEosNotification() { |
| 79 DCHECK(!read_cb_.is_null()); | 82 DCHECK(!read_cb_.is_null()); |
| 80 base::ResetAndReturn(&read_cb_).Run(kOk, DecoderBuffer::CreateEOSBuffer()); | 83 base::ResetAndReturn(&read_cb_).Run(kOk, DecoderBuffer::CreateEOSBuffer()); |
| 81 } | 84 } |
| 82 | 85 |
| 83 void FakeTextTrackStream::Stop() { | 86 void FakeTextTrackStream::Stop() { |
| 84 stopping_ = true; | 87 stopping_ = true; |
| 85 if (!read_cb_.is_null()) | 88 if (!read_cb_.is_null()) |
| 86 AbortPendingRead(); | 89 AbortPendingRead(); |
| 87 } | 90 } |
| 88 | 91 |
| 89 } // namespace media | 92 } // namespace media |
| OLD | NEW |