Deps: Update Ringbuf, Serde-Aux, Simd-Json, Typemap
This commit is contained in:
@@ -25,7 +25,7 @@ use tokio::{
|
||||
};
|
||||
|
||||
struct AsyncAdapterSink {
|
||||
bytes_in: Producer<u8>,
|
||||
bytes_in: HeapProducer<u8>,
|
||||
req_rx: Receiver<AdapterRequest>,
|
||||
resp_tx: Sender<AdapterResponse>,
|
||||
stream: Box<dyn AsyncMediaSource>,
|
||||
@@ -135,7 +135,7 @@ impl AsyncAdapterSink {
|
||||
/// pass along seek requests needed. This allows for passing bytes from exclusively `AsyncRead`
|
||||
/// streams (e.g., hyper HTTP sessions) to Songbird.
|
||||
pub struct AsyncAdapterStream {
|
||||
bytes_out: Consumer<u8>,
|
||||
bytes_out: HeapConsumer<u8>,
|
||||
can_seek: bool,
|
||||
// Note: this is Atomic just to work around the need for
|
||||
// check_messages to take &self rather than &mut.
|
||||
@@ -150,7 +150,7 @@ impl AsyncAdapterStream {
|
||||
/// between the async and sync halves.
|
||||
#[must_use]
|
||||
pub fn new(stream: Box<dyn AsyncMediaSource>, buf_len: usize) -> AsyncAdapterStream {
|
||||
let (bytes_in, bytes_out) = RingBuffer::new(buf_len).split();
|
||||
let (bytes_in, bytes_out) = SharedRb::new(buf_len).split();
|
||||
let (resp_tx, resp_rx) = flume::unbounded();
|
||||
let (req_tx, req_rx) = flume::unbounded();
|
||||
let can_seek = stream.is_seekable();
|
||||
@@ -264,7 +264,7 @@ impl Seek for AsyncAdapterStream {
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
||||
self.bytes_out.discard(self.bytes_out.capacity());
|
||||
self.bytes_out.skip(self.bytes_out.capacity());
|
||||
|
||||
let _ = self.req_tx.send(AdapterRequest::SeekCleared);
|
||||
|
||||
|
||||
@@ -89,10 +89,15 @@ impl From<TungsteniteError> for Error {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(unused_unsafe)]
|
||||
pub(crate) fn convert_ws_message(message: Option<Message>) -> Result<Option<Event>> {
|
||||
Ok(match message {
|
||||
// SAFETY:
|
||||
// simd-json::serde::from_str may leave an &mut str in a non-UTF state on failure.
|
||||
// The below is safe as we have taken ownership of the inner `String`, and don't
|
||||
// access it as a `str`/`String` or return it if failure occurs.
|
||||
Some(Message::Text(mut payload)) =>
|
||||
crate::json::from_str(payload.as_mut_str()).map(Some)?,
|
||||
unsafe { crate::json::from_str(payload.as_mut_str()) }.map(Some)?,
|
||||
Some(Message::Binary(bytes)) => {
|
||||
return Err(Error::UnexpectedBinaryMessage(bytes));
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user