Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit a58e103

Browse files
committed
1. Clean obsolete code
2. Remove macro LOW_LATENCY_USAGE 3. Unify media source control macro _ENABLE_DASH_SOURCE_ _ENABLE_WEBRTC_SOURCE_ 4. Disable WebRTC media source
1 parent ce7d1db commit a58e103

File tree

13 files changed

+66
-70
lines changed

13 files changed

+66
-70
lines changed

src/player/CMakeLists.txt

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,43 +17,31 @@ OPTION(USE_TRACE
1717

1818
PROJECT(player)
1919

20+
ADD_DEFINITIONS("-g -c -fPIC -lglog -std=c++11 -fpermissive")
21+
2022
IF(USE_OMAF)
21-
ADD_DEFINITIONS("-g -c -fPIC -lglog -std=c++11 -fpermissive")
23+
ADD_DEFINITIONS("-D_ENABLE_DASH_SOURCE_")
2224
ENDIF()
2325

2426
IF(USE_WEBRTC)
25-
ADD_DEFINITIONS("-g -c -fPIC -lglog -std=c++11 -fpermissive -DLOW_LATENCY_USAGE")
27+
IF(NOT DEFINED WEBRTC_LINUX_SDK)
28+
message(SEND_ERROR "WEBRTC_LINUX_SDK is required")
29+
ENDIF()
30+
31+
ADD_DEFINITIONS("-D_ENABLE_WEBRTC_SOURCE_ -DWEBRTC_LINUX -DWEBRTC_POSIX")
32+
INCLUDE_DIRECTORIES("${WEBRTC_LINUX_SDK}/include")
33+
LINK_DIRECTORIES("${WEBRTC_LINUX_SDK}/lib")
2634
ENDIF()
2735

2836
IF(USE_TRACE)
2937
ADD_DEFINITIONS("-D_USE_TRACE_")
30-
ENDIF()
31-
32-
IF(USE_OMAF)
33-
IF(USE_TRACE)
34-
INCLUDE_DIRECTORIES(/usr/local/include ../utils ../trace)
35-
LINK_DIRECTORIES(/usr/local/lib ../trace)
36-
ELSE()
37-
INCLUDE_DIRECTORIES(/usr/local/include ../utils)
38-
LINK_DIRECTORIES(/usr/local/lib)
39-
ENDIF()
40-
ENDIF()
41-
42-
IF(USE_WEBRTC)
38+
INCLUDE_DIRECTORIES(/usr/local/include ../utils ../trace)
39+
LINK_DIRECTORIES(/usr/local/lib ../trace)
40+
ELSE()
4341
INCLUDE_DIRECTORIES(/usr/local/include ../utils)
4442
LINK_DIRECTORIES(/usr/local/lib)
4543
ENDIF()
4644

47-
IF(USE_WEBRTC)
48-
IF(NOT DEFINED WEBRTC_LINUX_SDK)
49-
message(SEND_ERROR "WEBRTC_LINUX_SDK is required")
50-
ENDIF()
51-
52-
ADD_DEFINITIONS("-D_ENABLE_WEBRTC_SOURCE_ -DWEBRTC_LINUX -DWEBRTC_POSIX")
53-
INCLUDE_DIRECTORIES("${WEBRTC_LINUX_SDK}/include")
54-
LINK_DIRECTORIES("${WEBRTC_LINUX_SDK}/lib")
55-
ENDIF()
56-
5745
AUX_SOURCE_DIRECTORY(. DIR_SRC)
5846
AUX_SOURCE_DIRECTORY(../utils/ UTIL_SRC)
5947
AUX_SOURCE_DIRECTORY(./Decoder DEC_SRC)
@@ -73,18 +61,18 @@ set(DIR_SRC
7361
ADD_EXECUTABLE(render ${DIR_SRC} ${DEC_SRC} ${MEDSRC_SRC} ${RNDR_SRC} ${MESH_SRC})
7462

7563
IF(USE_OMAF)
76-
IF(USE_TRACE)
77-
SET(LINK_LIB ${LINK_LIB} OmafDashAccess trace lttng-ust)
78-
ELSE()
79-
SET(LINK_LIB ${LINK_LIB} OmafDashAccess)
80-
ENDIF()
64+
SET(LINK_LIB ${LINK_LIB} OmafDashAccess)
8165
ENDIF()
8266

8367
IF(USE_WEBRTC)
8468
SET(LINK_LIB ${LINK_LIB}
8569
owt sioclient_tls ssl crypto boost_system dl)
8670
ENDIF()
8771

72+
IF(USE_TRACE)
73+
SET(LINK_LIB ${LINK_LIB} trace lttng-ust)
74+
ENDIF()
75+
8876
SET(LINK_LIB ${LINK_LIB}
8977
avfilter avformat avcodec avdevice avutil swscale swresample
9078
360SCVP glfw GL GLU X11 pthread lzma z glog EGL GLESv2 dl safestring_shared)

src/player/Common.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,11 @@
3939

4040
#include "../utils/ns_def.h"
4141
#include "RenderType.h"
42-
#ifndef LOW_LATENCY_USAGE
4342
#include "data_type.h"
4443
extern "C"
4544
{
4645
#include "safestringlib/safe_mem_lib.h"
4746
}
48-
#endif
4947
#include "../utils/OmafStructure.h"
5048
#include "../utils/GlogWrapper.h"
5149

src/player/MediaPlayer.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,24 @@ RenderStatus MediaPlayer::Open()
8888
m_rsFactory = new RenderSourceFactory(window);
8989

9090
//initial MediaSource
91-
m_mediaSource = new DashMediaSource();
91+
switch (m_renderConfig.sourceType)
92+
{
93+
#ifdef _ENABLE_DASH_SOURCE_
94+
case DASH_SOURCE:
95+
m_mediaSource = new DashMediaSource();
96+
break;
97+
#endif
98+
#ifdef _ENABLE_WEBRTC_SOURCE_
99+
case WEBRTC_SOURCE:
100+
//m_mediaSource = new WebRTCMediaSource();
101+
LOG(ERROR)<<"WebRTC media source is not available!"<<std::endl;
102+
return RENDER_CREATE_ERROR;
103+
#endif
104+
default:
105+
m_mediaSource = NULL;
106+
LOG(ERROR)<<"initial media source error!"<<std::endl;
107+
return RENDER_CREATE_ERROR;
108+
}
92109

93110
//load media source and get type
94111
RenderStatus loadMediaStatus = m_mediaSource->Initialize(m_renderConfig, m_rsFactory);

src/player/MediaSource/DashMediaSource.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
//! \file DashMediaSource.cpp
3131
//! \brief Implement class for DashMediaSource.
3232
//!
33-
#ifndef _ENABLE_WEBRTC_SOURCE_
33+
#ifdef _ENABLE_DASH_SOURCE_
3434
#include "DashMediaSource.h"
3535
#include <stdio.h>
3636
#include <sys/timeb.h>
@@ -409,4 +409,4 @@ RenderStatus DashMediaSource::Play() {
409409
}
410410

411411
VCD_NS_END
412-
#endif // LOW_LATENCY_USAGE
412+
#endif // _ENABLE_DASH_SOURCE_

src/player/MediaSource/DashMediaSource.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
//! \file DashMediaSource.h
3131
//! \brief Defines class for DashMediaSource.
3232
//!
33-
#ifndef _ENABLE_WEBRTC_SOURCE_
33+
#ifdef _ENABLE_DASH_SOURCE_
3434

3535
#ifndef _DASHMEDIASOURCE_H_
3636
#define _DASHMEDIASOURCE_H_
@@ -167,4 +167,4 @@ class DashMediaSource
167167
VCD_NS_END
168168
#endif /* _DASHMEDIASOURCE_H_ */
169169

170-
#endif /* _NON_ENABLE_WEBRTC_SOURCE_ */
170+
#endif // _ENABLE_DASH_SOURCE_

src/player/MediaSource/WebRTCMediaSource.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
//! \file WebRTCMediaSource.cpp
3131
//! \brief Implement class for WebRTCMediaSource.
3232
//!
33-
#ifdef _ENABLE_WEBRTC_SOURCE_
33+
#if 0
34+
//#ifdef _ENABLE_WEBRTC_SOURCE_
3435

3536
#include "../Common.h"
3637
#include "WebRTCMediaSource.h"

src/player/MediaSource/WebRTCMediaSource.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
//! \file WebRTCMediaSource.h
3131
//! \brief Defines class for WebRTCMediaSource.
3232
//!
33-
#ifdef _ENABLE_WEBRTC_SOURCE_
33+
#if 0
34+
//#ifdef _ENABLE_WEBRTC_SOURCE_
3435

3536
#ifndef _WebRTCMediaSource_H_
3637
#define _WebRTCMediaSource_H_

src/player/MediaSource/http.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#ifdef LOW_LATENCY_USAGE
1+
#ifdef _ENABLE_WEBRTC_SOURCE_
22
#include "http.h"
33
#include <arpa/inet.h>
44
#include <netdb.h>
@@ -345,4 +345,4 @@ string CHttp::getToken(const string &addr, const string &room)
345345
string url = addr + "/createToken";
346346
return http_post(url, content);
347347
}
348-
#endif /* LOW_LATENCY_USAGE */
348+
#endif /* _ENABLE_WEBRTC_SOURCE_ */

src/player/MediaSource/http.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (C) <2019> Intel Corporation
22
//
33
// SPDX-License-Identifier: Apache-2.0
4-
#ifdef LOW_LATENCY_USAGE
4+
#ifdef _ENABLE_WEBRTC_SOURCE_
55
#pragma once
66
#include <string>
77

@@ -26,4 +26,4 @@ class CHttp
2626
static int http_tcpclient_send(int socket, char *buff, int size);
2727
static string http_parse_result(const char *lpbuf);
2828
};
29-
#endif /* LOW_LATENCY_USAGE */
29+
#endif /* _ENABLE_WEBRTC_SOURCE_ */

src/player/Player.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,24 @@ RenderStatus Player::Open()
9191
m_rsFactory = new RenderSourceFactory(window);
9292

9393
//initial MediaSource
94-
m_mediaSource = new DashMediaSource();
94+
switch (m_renderConfig.sourceType)
95+
{
96+
#ifdef _ENABLE_DASH_SOURCE_
97+
case DASH_SOURCE:
98+
m_mediaSource = new DashMediaSource();
99+
break;
100+
#endif
101+
#ifdef _ENABLE_WEBRTC_SOURCE_
102+
case WEBRTC_SOURCE:
103+
//m_mediaSource = new WebRTCMediaSource();
104+
LOG(ERROR)<<"WebRTC media source is not available!"<<std::endl;
105+
return RENDER_CREATE_ERROR;
106+
#endif
107+
default:
108+
m_mediaSource = NULL;
109+
LOG(ERROR)<<"initial media source error!"<<std::endl;
110+
return RENDER_CREATE_ERROR;
111+
}
95112

96113
//load media source and get type
97114
RenderStatus loadMediaStatus = m_mediaSource->Initialize(m_renderConfig, m_rsFactory);

0 commit comments

Comments
 (0)