From 72ba87c80315eafea80386f43b0eaaeb82170bb4 Mon Sep 17 00:00:00 2001 From: xia-chu <771730766@qq.com> Date: Sat, 17 Jun 2023 09:14:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dmk=5Fmedia=5Fsource=5Fget=5Ft?= =?UTF-8?q?rack=E6=8E=A5=E5=8F=A3=E5=B4=A9=E6=BA=83=E9=97=AE=E9=A2=98:#255?= =?UTF-8?q?2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/include/mk_events_objects.h | 2 +- api/source/mk_events_objects.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/include/mk_events_objects.h b/api/include/mk_events_objects.h index 425243a6..018988f4 100644 --- a/api/include/mk_events_objects.h +++ b/api/include/mk_events_objects.h @@ -98,7 +98,7 @@ API_EXPORT int API_CALL mk_media_source_get_reader_count(const mk_media_source c API_EXPORT int API_CALL mk_media_source_get_total_reader_count(const mk_media_source ctx); // get track count from MediaSource API_EXPORT int API_CALL mk_media_source_get_track_count(const mk_media_source ctx); -// get track by index from MediaSource +// copy track reference by index from MediaSource, please use mk_track_unref to release it API_EXPORT mk_track API_CALL mk_media_source_get_track(const mk_media_source ctx, int index); /** * 直播源在ZLMediaKit中被称作为MediaSource, diff --git a/api/source/mk_events_objects.cpp b/api/source/mk_events_objects.cpp index b92aa7e8..c8656cec 100644 --- a/api/source/mk_events_objects.cpp +++ b/api/source/mk_events_objects.cpp @@ -211,7 +211,7 @@ API_EXPORT mk_track API_CALL mk_media_source_get_track(const mk_media_source ctx if (index < 0 && index >= tracks.size()) { return nullptr; } - return reinterpret_cast(& (tracks[index])); + return (mk_track) new Track::Ptr(std::move(tracks[index])); } API_EXPORT int API_CALL mk_media_source_close(const mk_media_source ctx,int force){