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 "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 } | 45 } |
46 | 46 |
47 void FakeTextTrackStream::SatisfyPendingRead( | 47 void FakeTextTrackStream::SatisfyPendingRead( |
48 const base::TimeDelta& start, | 48 const base::TimeDelta& start, |
49 const base::TimeDelta& duration, | 49 const base::TimeDelta& duration, |
50 const std::string& id, | 50 const std::string& id, |
51 const std::string& content, | 51 const std::string& content, |
52 const std::string& settings) { | 52 const std::string& settings) { |
53 DCHECK(!read_cb_.is_null()); | 53 DCHECK(!read_cb_.is_null()); |
54 | 54 |
55 const uint8* const data_buf = reinterpret_cast<const uint8*>(content.data()); | 55 const uint8_t* const data_buf = |
| 56 reinterpret_cast<const uint8_t*>(content.data()); |
56 const int data_len = static_cast<int>(content.size()); | 57 const int data_len = static_cast<int>(content.size()); |
57 | 58 |
58 std::vector<uint8> side_data; | 59 std::vector<uint8_t> side_data; |
59 MakeSideData(id.begin(), id.end(), | 60 MakeSideData(id.begin(), id.end(), |
60 settings.begin(), settings.end(), | 61 settings.begin(), settings.end(), |
61 &side_data); | 62 &side_data); |
62 | 63 |
63 const uint8* const sd_buf = &side_data[0]; | 64 const uint8_t* const sd_buf = &side_data[0]; |
64 const int sd_len = static_cast<int>(side_data.size()); | 65 const int sd_len = static_cast<int>(side_data.size()); |
65 | 66 |
66 scoped_refptr<DecoderBuffer> buffer; | 67 scoped_refptr<DecoderBuffer> buffer; |
67 buffer = DecoderBuffer::CopyFrom(data_buf, data_len, sd_buf, sd_len); | 68 buffer = DecoderBuffer::CopyFrom(data_buf, data_len, sd_buf, sd_len); |
68 | 69 |
69 buffer->set_timestamp(start); | 70 buffer->set_timestamp(start); |
70 buffer->set_duration(duration); | 71 buffer->set_duration(duration); |
71 | 72 |
72 // Assume all fake text buffers are keyframes. | 73 // Assume all fake text buffers are keyframes. |
73 buffer->set_is_key_frame(true); | 74 buffer->set_is_key_frame(true); |
(...skipping 11 matching lines...) Expand all Loading... |
85 base::ResetAndReturn(&read_cb_).Run(kOk, DecoderBuffer::CreateEOSBuffer()); | 86 base::ResetAndReturn(&read_cb_).Run(kOk, DecoderBuffer::CreateEOSBuffer()); |
86 } | 87 } |
87 | 88 |
88 void FakeTextTrackStream::Stop() { | 89 void FakeTextTrackStream::Stop() { |
89 stopping_ = true; | 90 stopping_ = true; |
90 if (!read_cb_.is_null()) | 91 if (!read_cb_.is_null()) |
91 AbortPendingRead(); | 92 AbortPendingRead(); |
92 } | 93 } |
93 | 94 |
94 } // namespace media | 95 } // namespace media |
OLD | NEW |