Skip to content

Commit 03d6e96

Browse files
authored
Feature/fix catchup (#547)
Catchup fix Changed allocator to mimalloc
1 parent af3f1f9 commit 03d6e96

4 files changed

Lines changed: 45 additions & 38 deletions

File tree

Cargo.lock

Lines changed: 21 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/Cargo.toml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,22 @@ hyper-util = "0.1"
6969
socket2 = { version = "0.6", features = ["all"] }
7070
async-compression = { version = "0.4", features = ["tokio"] }
7171
crc32fast = "1.5"
72-
#[cfg(target_os = "macos")]
73-
libc = "0.2"
74-
#[cfg(target_os = "windows")]
75-
winapi = { version = "0.3", features = ["psapi", "minwindef", "processthreadsapi"] }
7672
chrono-tz = "0.10.4"
7773
zeroize = "1.8.2"
7874
sysinfo = { version = "0.37.2", default-features = false, features = ["system"] }
7975
uuid = { version = "1", features = ["v4"] }
8076
fancy-regex = "0.17.0"
8177
mime_guess = "2"
82-
# [target.'cfg(not(target_env = "msvc"))'.dependencies]
78+
79+
[target.'cfg(target_os = "macos")'.dependencies]
80+
libc = "0.2"
81+
[target.'cfg(target_os = "windows")'.dependencies]
82+
winapi = { version = "0.3", features = ["psapi", "minwindef", "processthreadsapi"] }
83+
[target.'cfg(target_os = "linux")'.dependencies]
84+
mimalloc = "0.1"
85+
86+
#[target.'cfg(not(target_env = "msvc"))'.dependencies]
87+
#tikv-jemallocator = "0.6"
8388
# tikv-jemallocator = { version = "*", features = ["profiling", "unprefixed_malloc_on_supported_platforms"] }
8489

8590
[build-dependencies]

backend/src/api/endpoints/xtream_api.rs

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -689,34 +689,11 @@ async fn xtream_player_api_timeshift_stream(
689689
axum::extract::State(app_state): axum::extract::State<Arc<AppState>>,
690690
axum::extract::Form(api_form_req): axum::extract::Form<UserApiRequest>,
691691
) -> impl IntoResponse + Send {
692-
let username = get_non_empty(
693-
&timeshift_request.username,
694-
&api_form_req.username,
695-
&api_req.username,
696-
)
697-
.to_string();
698-
let password = get_non_empty(
699-
&timeshift_request.password,
700-
&api_form_req.password,
701-
&api_req.password,
702-
)
703-
.to_string();
704-
let stream_id = get_non_empty(
705-
&timeshift_request.stream_id,
706-
&api_req.stream_id,
707-
&api_form_req.stream_id,
708-
)
709-
.to_string();
710-
let duration = get_non_empty(
711-
&timeshift_request.duration,
712-
&timeshift_request.duration,
713-
&api_form_req.duration,
714-
);
715-
let start = get_non_empty(
716-
&timeshift_request.start,
717-
&timeshift_request.start,
718-
&api_form_req.start,
719-
);
692+
let username = get_non_empty(&timeshift_request.username, &api_form_req.username, &api_req.username).to_string();
693+
let password = get_non_empty(&timeshift_request.password, &api_form_req.password, &api_req.password).to_string();
694+
let stream_id = get_non_empty(&timeshift_request.stream_id, &api_req.stream_id, &api_form_req.stream_id).to_string();
695+
let duration = get_non_empty(&timeshift_request.duration, &timeshift_request.duration, &api_form_req.duration);
696+
let start = get_non_empty(&timeshift_request.start, &timeshift_request.start, &api_form_req.start);
720697

721698
let action_path = format!("{duration}/{start}");
722699
api_req.username.clone_from(&username);
@@ -1050,7 +1027,7 @@ async fn xtream_get_catchup_response(
10501027
&uuid,
10511028
catchup_provider_id,
10521029
PlaylistItemType::Catchup,
1053-
pli.virtual_id,
1030+
pli.provider_id,
10541031
);
10551032

10561033
if target.use_memory_cache {
@@ -1059,7 +1036,7 @@ async fn xtream_get_catchup_response(
10591036
catchup_provider_id,
10601037
virtual_id,
10611038
PlaylistItemType::Catchup,
1062-
pli.virtual_id,
1039+
pli.provider_id,
10631040
uuid,
10641041
),
10651042
);

backend/src/main.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
#![allow(clippy::return_self_not_must_use)]
55
#![allow(clippy::missing_errors_doc)]
66

7+
#[cfg(target_os = "linux")]
8+
#[global_allocator]
9+
static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
10+
// #[cfg(not(target_env = "msvc"))]
11+
// #[global_allocator]
12+
// static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
13+
714
#[macro_use]
815
mod modules;
916

0 commit comments

Comments
 (0)