@@ -113,6 +113,7 @@ def __init__(self, worker_queue, stream_info, config):
113113 self ._stream_url_list = []
114114 self ._stream_acrid = stream_info ['acr_id' ]
115115 self ._program_id = stream_info .get ('program_id' , - 1 )
116+ self ._extra_opt = stream_info .get ('extra_opt' )
116117 self ._worker_queue = worker_queue
117118 self ._fp_interval = self ._config .get ('fp_interval_sec' , 2 )
118119 self ._download_timeout = self ._config .get ('download_timeout_sec' , 10 )
@@ -151,6 +152,13 @@ def _decode_stream(self, stream_url):
151152 }
152153 if (self ._retry_n > 1 and stream_url [:4 ] == 'rtsp' ):
153154 acrdict ['extra_opt' ] = {'rtsp_transport' :'tcp' }
155+ if self ._extra_opt :
156+ if 'extra_opt' in acrdict :
157+ for k , v in self ._extra_opt .items ():
158+ acrdict ['extra_opt' ][k ] = v
159+ else :
160+ acrdict ['extra_opt' ] = self ._extra_opt
161+
154162 code , msg , ffcode , ffmsg = acrcloud_stream_tool .decode_audio (acrdict )
155163 #if code == 0:
156164 # self._is_stop = True
@@ -309,7 +317,7 @@ def run(self):
309317 if len (record_last_buf ) > self ._record_upload_interval * 16000 :
310318 record_fp = acrcloud_stream_tool .create_fingerprint (record_last_buf , False , 50 , 0 )
311319 if record_fp and self ._upload_record (record_fp , ts ):
312- record_last_buf = ''
320+ record_last_buf = b ''
313321 else :
314322 if len (record_last_buf ) > self ._record_fp_max_time * 16000 :
315323 record_last_buf = record_last_buf [len (last_buf )- self ._record_fp_max_time * 16000 :]
@@ -535,12 +543,12 @@ def init_log(logging_level, log_file):
535543 logger1 .setLevel (logging_level )
536544 if log_file .strip ():
537545 acrcloud_stream = logging .handlers .RotatingFileHandler (log_file , maxBytes = 10 * 1024 * 1024 , backupCount = 1 )
538- acrcloud_stream .setFormatter (logging .Formatter ('%(asctime)s - %(levelname)s - %(funcName)s - %(message)s' ))
546+ acrcloud_stream .setFormatter (logging .Formatter ('%(asctime)s - %(levelname)s - %(funcName)s - %(lineno)s- %( message)s' ))
539547 acrcloud_stream .setLevel (logging_level )
540548 logger1 .addHandler (acrcloud_stream )
541549 else :
542550 ch = logging .StreamHandler ()
543- ch .setFormatter (logging .Formatter ('%(asctime)s - %(levelname)s - %(funcName)s - %(message)s' ))
551+ ch .setFormatter (logging .Formatter ('%(asctime)s - %(levelname)s - %(funcName)s - %(lineno)s - %( message)s' ))
544552 ch .setLevel (logging_level )
545553 logger1 .addHandler (ch )
546554 return logger1
0 commit comments