@@ -23,8 +23,6 @@ pub mod subscriptions;
2323use buffers:: Buffer ;
2424pub use stream_config:: * ;
2525
26- use std:: time:: Instant ;
27-
2826/// This function will print Hello World.
2927#[ no_mangle]
3028pub extern "C" fn hello ( ) -> bool {
@@ -106,7 +104,8 @@ pub trait BufferSubscriber {
106104/// BufferSubscriptions serve as the bridge between BufferPublishers and
107105/// BufferSubscribers. BufferSubscribers receive a BufferSubscription when they
108106/// subscribe to a BufferPublisher via on_subscribe.
109- /// This object is to be used by the BufferSubscriber to cancel its subscription
107+ ///
108+ /// This object is used by the BufferSubscriber to cancel its subscription
110109/// or request more buffers.
111110///
112111/// BufferSubcriptions are required to adhere to the following, based on the
@@ -147,7 +146,7 @@ pub trait BufferSubscriber {
147146/// no other Subscription exists at this point.
148147/// * Calling Subscription.cancel MUST return normally.
149148/// * Calling Subscription.request MUST return normally.
150- pub trait BufferSubscription {
149+ pub trait BufferSubscription : Send + Sync + ' static {
151150 /// request
152151 fn request ( & self , n : u64 ) ;
153152 /// cancel
@@ -161,8 +160,8 @@ pub type BufferError = anyhow::Error;
161160pub struct Frame {
162161 /// A buffer to be used this frame.
163162 pub buffer : Buffer ,
164- /// The time at which the buffer was dispatched .
165- pub present_time : Instant ,
163+ /// The time at which this buffer is expected to be displayed .
164+ pub present_time : i64 ,
166165 /// A fence used for reading/writing safely.
167166 pub fence : i32 ,
168167}
@@ -175,14 +174,12 @@ mod test {
175174 use anyhow:: anyhow;
176175 use buffers:: Buffer ;
177176 use nativewindow:: { AHardwareBuffer_Format , AHardwareBuffer_UsageFlags } ;
178- use std:: borrow:: BorrowMut ;
179- use std:: error:: Error ;
180- use std:: ops:: Add ;
181- use std:: sync:: Arc ;
182- use std:: time:: Duration ;
177+ use std:: { borrow:: BorrowMut , error:: Error , ops:: Add , sync:: Arc } ;
183178
184- use crate :: publishers:: testing:: * ;
185- use crate :: subscribers:: { testing:: * , SharedSubscriber } ;
179+ use crate :: {
180+ publishers:: testing:: * ,
181+ subscribers:: { testing:: * , SharedSubscriber } ,
182+ } ;
186183
187184 const STREAM_CONFIG : StreamConfig = StreamConfig {
188185 width : 1 ,
@@ -200,7 +197,7 @@ mod test {
200197 . create_hardware_buffer ( )
201198 . expect ( "Unable to create hardware buffer for test" ) ,
202199 ) ,
203- present_time : Instant :: now ( ) + Duration :: from_secs ( 1 ) ,
200+ present_time : 1 ,
204201 fence : 0 ,
205202 }
206203 }
0 commit comments